當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectOutput.flush方法代碼示例

本文整理匯總了Java中java.io.ObjectOutput.flush方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectOutput.flush方法的具體用法?Java ObjectOutput.flush怎麽用?Java ObjectOutput.flush使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.io.ObjectOutput的用法示例。


在下文中一共展示了ObjectOutput.flush方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writeExternal

import java.io.ObjectOutput; //導入方法依賴的package包/類
/**
 * @see java.io.Externalizable#writeExternal(ObjectOutput)
 */
@Override
public void writeExternal( ObjectOutput out ) throws IOException
{
    // The operation
    out.writeInt( operation.getValue() );

    // The EntryAttribute if not null
    if ( attribute != null )
    {
        out.writeBoolean( true );
        attribute.writeExternal( out );
    }
    else
    {
        out.writeBoolean( false );
    }

    out.flush();
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:23,代碼來源:DefaultModification.java

示例2: writeExternal

import java.io.ObjectOutput; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void writeExternal( ObjectOutput out ) throws IOException
{
    out.writeUTF( oid );
    out.writeBoolean( criticality );

    if ( hasValue() )
    {
        out.writeBoolean( true );
        out.writeInt( value.length );

        if ( value.length > 0 )
        {
            out.write( value );
        }
    }
    else
    {
        out.writeBoolean( false );
    }

    out.flush();
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:27,代碼來源:LdifControl.java

示例3: writeExternal

import java.io.ObjectOutput; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void writeExternal( ObjectOutput out ) throws IOException
{
    if ( upName == null )
    {
        String message = "Cannot serialize a NULL Dn";
        LOG.error( message );
        throw new IOException( message );
    }

    // Write the UPName
    out.writeUTF( upName );

    // Write the RDNs.
    // First the number of RDNs
    out.writeInt( size() );

    // Loop on the RDNs
    for ( Rdn rdn : rdns )
    {
        rdn.writeExternal( out );
    }

    out.flush();
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:29,代碼來源:Dn.java

示例4: toByteArray

import java.io.ObjectOutput; //導入方法依賴的package包/類
public byte[] toByteArray() throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutput out = new ObjectOutputStream(baos);
    out.writeObject(this);
    out.flush();
    return baos.toByteArray();
}
 
開發者ID:flschiavoni,項目名稱:shareMySheet,代碼行數:8,代碼來源:Message.java

示例5: writeExternal

import java.io.ObjectOutput; //導入方法依賴的package包/類
/**
 * This is the place where we serialize entries, and all theirs
 * elements.
 * <br>
 * The structure used to store the entry is the following :
 * <ul>
 *   <li>
 *     <b>[Dn]</b> : If it's null, stores an empty Dn
 *   </li>
 *   <li>
 *     <b>[attributes number]</b> : the number of attributes.
 *   </li>
 *   <li>
 *     <b>[attribute]*</b> : each attribute, if we have some
 *   </li>
 * </ul>
 * 
 * {@inheritDoc}
 */
@Override
public void writeExternal( ObjectOutput out ) throws IOException
{
    // First, the Dn
    if ( dn == null )
    {
        // Write an empty Dn
        Dn.EMPTY_DN.writeExternal( out );
    }
    else
    {
        // Write the Dn
        dn.writeExternal( out );
    }

    // Then the attributes.
    // Store the attributes' nulber first
    out.writeInt( attributes.size() );

    // Iterate through the keys.
    for ( Attribute attribute : attributes.values() )
    {
        // Store the attribute
        attribute.writeExternal( out );
    }

    out.flush();
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:48,代碼來源:DefaultEntry.java

示例6: writeExternal

import java.io.ObjectOutput; //導入方法依賴的package包/類
/**
 * This is the place where we serialize attributes, and all theirs
 * elements.
 * 
 * {@inheritDoc}
 */
@Override
public void writeExternal( ObjectOutput out ) throws IOException
{
    // Write the UPId
    out.writeUTF( upId );
    
    // Write the ID
    out.writeUTF( id );

    // Write the HR flag, if not null
    if ( isHR != null )
    {
        out.writeBoolean( true );
        out.writeBoolean( isHR );
    }
    else
    {
        out.writeBoolean( false );
    }

    // Write the number of values
    out.writeInt( size() );

    if ( size() > 0 )
    {
        // Write each value
        for ( Value value : values )
        {
            // Write the value
            value.writeExternal( out );
        }
    }

    out.flush();
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:42,代碼來源:DefaultAttribute.java

示例7: serialize

import java.io.ObjectOutput; //導入方法依賴的package包/類
@Override
public byte[] serialize(Object obj) throws TccException {
    try (ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream()) {
        ObjectOutput objectOutput = new ObjectOutputStream(arrayOutputStream);
        objectOutput.writeObject(obj);
        objectOutput.flush();
        objectOutput.close();
        return arrayOutputStream.toByteArray();
    } catch (IOException e) {
        throw new TccException("JAVA serialize error " + e.getMessage());
    }
}
 
開發者ID:yu199195,項目名稱:happylifeplat-tcc,代碼行數:13,代碼來源:JavaSerializer.java

示例8: writeExternal

import java.io.ObjectOutput; //導入方法依賴的package包/類
@Override
public void writeExternal(ObjectOutput out) throws IOException {
	out.writeObject(color.getRed());
	out.writeObject(color.getGreen());
	out.writeObject(color.getBlue());
	out.writeObject(color.getOpacity());
	out.flush();
}
 
開發者ID:enoy19,項目名稱:keyboard-light-composer,代碼行數:9,代碼來源:KlcColor.java

示例9: writeExternal

import java.io.ObjectOutput; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void writeExternal( ObjectOutput out ) throws IOException
{
    // Write a boolean for the HR flag
    out.writeBoolean( isHR );

    if ( isHR )
    { 
        // Write the value if any
        out.writeBoolean( upValue != null );

        if ( upValue != null )
        {
            // Write the value
            out.writeInt( bytes.length );

            if ( bytes.length > 0 )
            {
                out.write( bytes );
            }
        }

        // Write the prepared value if any
        out.writeBoolean( normValue != null );

        if ( normValue != null )
        {
            // Write the value
            out.writeUTF( normValue );
        }
    }
    else
    {
        // Just write the bytes if not null
        out.writeBoolean( bytes != null );

        if ( bytes != null )
        {
            out.writeInt( bytes.length );
            
            if ( bytes.length > 0 )
            {
                out.write( bytes );
            }
        }
    }

    // and flush the data
    out.flush();
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:54,代碼來源:Value.java

示例10: writeExternal

import java.io.ObjectOutput; //導入方法依賴的package包/類
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(_bitSize);
    out.writeInt(_mask);
    out.writeObject(_bits);
    out.flush();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:7,代碼來源:BitArray.java

示例11: writeExternal

import java.io.ObjectOutput; //導入方法依賴的package包/類
/**
 * A Rdn is composed of on to many Avas (AttributeType And Value).
 * We should write all those Avas sequencially, following the
 * structure :
 * <ul>
 *   <li>
 *     <b>parentId</b> The parent entry's Id
 *   </li>
 *   <li>
 *     <b>nbAvas</b> The number of Avas to write. Can't be 0.
 *   </li>
 *   <li>
 *     <b>upName</b> The User provided Rdn
 *   </li>
 *   <li>
 *     <b>Avas</b>
 *   </li>
 * </ul>
 * <br>
 * For each Ava :
 * <ul>
 *   <li>
 *     <b>start</b> The position of this Ava in the upName string
 *   </li>
 *   <li>
 *     <b>length</b> The Ava user provided length
 *   </li>
 *   <li>
 *     <b>Call the Ava write method</b> The Ava itself
 *   </li>
 * </ul>
 *
 * @see Externalizable#readExternal(ObjectInput)
 * @param out The stream into which the serialized Rdn will be put
 * @throws IOException If the stream can't be written
 */
@Override
public void writeExternal( ObjectOutput out ) throws IOException
{
    out.writeInt( nbAvas );
    out.writeUTF( upName );

    switch ( nbAvas )
    {
        case 0:
            break;

        case 1:
            ava.writeExternal( out );
            break;

        default:
            for ( Ava localAva : avas )
            {
                localAva.writeExternal( out );
            }

            break;
    }

    out.writeInt( h );

    out.flush();
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:65,代碼來源:Rdn.java


注:本文中的java.io.ObjectOutput.flush方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。