Package org.fusesource.hawtbuf.codec
Class FixedBufferCodec
java.lang.Object
org.fusesource.hawtbuf.codec.FixedBufferCodec
Implementation of a Marshaller for Buffer objects
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRead the payload of the object from the DataInput stream.void
encode
(Buffer value, DataOutput dataOut) Write the payload of the object to the DataOutput stream.int
estimatedSize
(Buffer object) int
boolean
boolean
-
Field Details
-
size
private final int size
-
-
Constructor Details
-
FixedBufferCodec
public FixedBufferCodec(int size)
-
-
Method Details
-
encode
Description copied from interface:Codec
Write the payload of the object to the DataOutput stream.- Specified by:
encode
in interfaceCodec<Buffer>
- Parameters:
value
-dataOut
-- Throws:
IOException
-
decode
Description copied from interface:Codec
Read the payload of the object from the DataInput stream.- Specified by:
decode
in interfaceCodec<Buffer>
- Parameters:
dataIn
-- Returns:
- unmarshalled object
- Throws:
IOException
-
getFixedSize
public int getFixedSize()- Specified by:
getFixedSize
in interfaceCodec<Buffer>
- Returns:
- -1 if the object do not always marshall to a fixed size, otherwise return that fixed size.
-
deepCopy
-
isDeepCopySupported
public boolean isDeepCopySupported()- Specified by:
isDeepCopySupported
in interfaceCodec<Buffer>
- Returns:
- true if the
Codec.deepCopy(Object)
operations is supported.
-
isEstimatedSizeSupported
public boolean isEstimatedSizeSupported()- Specified by:
isEstimatedSizeSupported
in interfaceCodec<Buffer>
- Returns:
- true if the
Codec.estimatedSize(Object)
operation is supported.
-
estimatedSize
- Specified by:
estimatedSize
in interfaceCodec<Buffer>
- Parameters:
object
-- Returns:
- the estimated marshaled size of the object.
-