java/proto/src/main/java/com/pravala/protocol/SerializableBase.java
public void serializeWithLength ( OutputStream toStream ) throws IOException, CodecException
    {
        assert toStream != null;

        if ( toStream == null )
        {
            throw new CodecException ( ErrorCode.InvalidParameter );
        }

        ByteArrayOutputStream buf = new ByteArrayOutputStream();

        serializeData ( buf );

        if ( buf.size() < 0 )
        {
            throw new CodecException ( ErrorCode.TooMuchData );
        }

        Codec.appendField ( toStream, ( Integer ) buf.size(), 0 );
        buf.writeTo ( toStream );
    }
/**
     * Serializes entire message to the buffer
     *
     * It calls serializeData from inheriting classes and also encodes the total message's length.
     * @param toStream The stream to serialize the data to
     * @throws java.io.IOException, CodecException
     */
Serializes entire message to the buffer
It calls serializeData from inheriting classes and also encodes the total message's length.
@param toStream The stream to serialize the data to
@throws java.io.IOException, CodecException
Serializes entire message to the buffer It calls serializeData from inheriting classes and also encodes the total message ' s length . @param toStream The stream to serialize the data to @throws java . io . IOException CodecException
public void serializeWithLength ( OutputStream toStream ) throws IOException, CodecException
    {
        assert toStream != null;
        if ( toStream == null )
        {
            throw new CodecException ( ErrorCode.InvalidParameter );
        }
        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        serializeData ( buf );
        if ( buf.size() < 0 )
        {
            throw new CodecException ( ErrorCode.TooMuchData );
        }
        Codec.appendField ( toStream, ( Integer ) buf.size(), 0 );
        buf.writeTo ( toStream );
    }
public void serializeWithLength ( OutputStream toStream ) throws IOException , CodecException { assert toStream != null ; if ( toStream == null ) { throw new CodecException ( ErrorCode . InvalidParameter ) ; } ByteArrayOutputStream buf = new ByteArrayOutputStream ( ) ; serializeData ( buf ) ; if ( buf . size ( ) < 0 ) { throw new CodecException ( ErrorCode . TooMuchData ) ; } Codec . appendField ( toStream , ( Integer ) buf . size ( ) , 0 ) ; buf . writeTo ( toStream ) ; }
Serializes entire message to the buffer
 It calls serializeData from inheriting classes and also encodes the total message's length.
Serializes entire message to the buffer It calls serializeData from inheriting classes and also encodes the total message ' s length .