Package 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
Modifier and TypeMethodDescriptionRead the payload of the object from the DataInput stream.void
encode
(T object, DataOutput dataOut) Write the payload of the object to the DataOutput stream.int
estimatedSize
(T object) int
boolean
boolean
-
Method Details
-
encode
Write the payload of the object to the DataOutput stream.- Parameters:
object
-dataOut
-- Throws:
IOException
-
decode
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
- Parameters:
object
-- Returns:
- the estimated marshaled size of the object.
-
isDeepCopySupported
boolean isDeepCopySupported()- Returns:
- true if the
deepCopy(Object)
operations is supported.
-
deepCopy
- Returns:
- a deep copy of the source object. If the source is immutable the same source should be returned.
-