org.fusesource.hawtbuf.codec
Interface Codec<T>

All Known Implementing Classes:
AbstractBufferCodec, AsciiBufferCodec, BufferCodec, BytesCodec, FixedBufferCodec, IntegerCodec, LongCodec, ObjectCodec, PBMessageFramedCodec, PBMessageUnframedCodec, StringCodec, UTF8BufferCodec, VariableCodec, VarIntegerCodec, VarLongCodec, VarSignedIntegerCodec, VarSignedLongCodec

public interface Codec<T>


Method Summary
 T decode(DataInput dataIn)
          Read the payload of the object from the DataInput stream.
 T deepCopy(T source)
           
 void encode(T object, DataOutput dataOut)
          Write the payload of the object to the DataOutput stream.
 int estimatedSize(T object)
           
 int getFixedSize()
           
 boolean isDeepCopySupported()
           
 boolean isEstimatedSizeSupported()
           
 

Method Detail

encode

void encode(T object,
            DataOutput dataOut)
            throws IOException
Write the payload of the object to the DataOutput stream.

Parameters:
object -
dataOut -
Throws:
IOException

decode

T decode(DataInput dataIn)
         throws IOException
Read the payload of the object from the DataInput stream.

Parameters:
dataIn -
Returns:
unmarshalled object
Throws:
IOException

getFixedSize

int getFixedSize()
Returns:
-1 if the object do not always marshall to a fixed size, otherwise return that fixed size.

isEstimatedSizeSupported

boolean isEstimatedSizeSupported()
Returns:
true if the estimatedSize(Object) operation is supported.

estimatedSize

int estimatedSize(T object)
Parameters:
object -
Returns:
the estimated marshaled size of the object.

isDeepCopySupported

boolean isDeepCopySupported()
Returns:
true if the deepCopy(Object) operations is supported.

deepCopy

T deepCopy(T source)
Returns:
a deep copy of the source object. If the source is immutable the same source should be returned.


Copyright © 2010-2014 FuseSource, Corp.. All Rights Reserved.