Package org.fusesource.hawtbuf.codec
Class BytesCodec
- java.lang.Object
-
- org.fusesource.hawtbuf.codec.BytesCodec
-
-
Field Summary
Fields Modifier and Type Field Description static BytesCodec
INSTANCE
-
Constructor Summary
Constructors Constructor Description BytesCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
decode(java.io.DataInput dataIn)
Read the payload of the object from the DataInput stream.byte[]
deepCopy(byte[] source)
void
encode(byte[] data, java.io.DataOutput dataOut)
Write the payload of the object to the DataOutput stream.int
estimatedSize(byte[] object)
int
getFixedSize()
boolean
isDeepCopySupported()
boolean
isEstimatedSizeSupported()
-
-
-
Field Detail
-
INSTANCE
public static final BytesCodec INSTANCE
-
-
Method Detail
-
encode
public void encode(byte[] data, java.io.DataOutput dataOut) throws java.io.IOException
Description copied from interface:Codec
Write the payload of the object to the DataOutput stream.
-
decode
public byte[] decode(java.io.DataInput dataIn) throws java.io.IOException
Description copied from interface:Codec
Read the payload of the object from the DataInput stream.
-
getFixedSize
public int getFixedSize()
- Specified by:
getFixedSize
in interfaceCodec<byte[]>
- Returns:
- -1 if the object do not always marshall to a fixed size, otherwise return that fixed size.
-
deepCopy
public byte[] deepCopy(byte[] source)
-
isDeepCopySupported
public boolean isDeepCopySupported()
- Specified by:
isDeepCopySupported
in interfaceCodec<byte[]>
- Returns:
- true if the
Codec.deepCopy(Object)
operations is supported.
-
isEstimatedSizeSupported
public boolean isEstimatedSizeSupported()
- Specified by:
isEstimatedSizeSupported
in interfaceCodec<byte[]>
- Returns:
- true if the
Codec.estimatedSize(Object)
operation is supported.
-
estimatedSize
public int estimatedSize(byte[] object)
- Specified by:
estimatedSize
in interfaceCodec<byte[]>
- Returns:
- the estimated marshaled size of the object.
-
-