java/proto/src/main/java/com/pravala/protocol/Codec.java
public static void appendField ( OutputStream toStream, String value, int fieldId )
    throws IOException, CodecException
    {
        if ( fieldId < 0 )
        {
            throw new CodecException ( ErrorCode.InvalidParameter );
        }

        if ( value == null || value.length() < 1 )
        {
            appendFieldHeader ( toStream, fieldId, WIRE_TYPE_ZERO, 0 );
            return;
        }

        byte[] data = value.getBytes();

        appendFieldHeader ( toStream, fieldId, getWireTypeForSize ( data.length ), data.length );
        toStream.write ( data );
    }
/**
     *  Writes a single value to the stream
     *
     * @param toStream The stream to append the data to
     * @param value The value to append to the stream
     * @param fieldId ID of the field to store in the header
     *
     * @throws IOException Thrown by OutputStream.write, CodecException
     **/
Writes a single value to the stream
@param toStream The stream to append the data to
@param value The value to append to the stream
@param fieldId ID of the field to store in the header


Writes a single value to the stream @param toStream The stream to append the data to @param value The value to append to the stream @param fieldId ID of the field to store in the header
public static void appendField ( OutputStream toStream, String value, int fieldId )
    throws IOException, CodecException
    {
        if ( fieldId < 0 )
        {
            throw new CodecException ( ErrorCode.InvalidParameter );
        }
        if ( value == null || value.length() < 1 )
        {
            appendFieldHeader ( toStream, fieldId, WIRE_TYPE_ZERO, 0 );
            return;
        }
        byte[] data = value.getBytes();
        appendFieldHeader ( toStream, fieldId, getWireTypeForSize ( data.length ), data.length );
        toStream.write ( data );
    }
public static void appendField ( OutputStream toStream , String value , int fieldId ) throws IOException , CodecException { if ( fieldId < 0 ) { throw new CodecException ( ErrorCode . InvalidParameter ) ; } if ( value == null || value . length ( ) < 1 ) { appendFieldHeader ( toStream , fieldId , WIRE_TYPE_ZERO , 0 ) ; return ; } byte [ ] data = value . getBytes ( ) ; appendFieldHeader ( toStream , fieldId , getWireTypeForSize ( data . length ) , data . length ) ; toStream . write ( data ) ; }
Writes a single value to the stream
 @param toStream The stream to append the data to
 @param value The value to append to the stream
 @param fieldId ID of the field to store in the header
Writes a single value to the stream @param toStream The stream to append the data to @param value The value to append to the stream @param fieldId ID of the field to store in the header