Package org.fusesource.hawtbuf.codec
Class AbstractBufferCodec<T extends Buffer>
- java.lang.Object
-
- org.fusesource.hawtbuf.codec.VariableCodec<T>
-
- org.fusesource.hawtbuf.codec.AbstractBufferCodec<T>
-
- All Implemented Interfaces:
Codec<T>
- Direct Known Subclasses:
AsciiBufferCodec,BufferCodec,UTF8BufferCodec
public abstract class AbstractBufferCodec<T extends Buffer> extends VariableCodec<T>
Implementation of a Codec for Buffer objects
-
-
Constructor Summary
Constructors Constructor Description AbstractBufferCodec()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract TcreateBuffer(byte[] data)Tdecode(java.io.DataInput dataIn)Read the payload of the object from the DataInput stream.TdeepCopy(T source)voidencode(T value, java.io.DataOutput dataOut)Write the payload of the object to the DataOutput stream.intestimatedSize(T object)booleanisDeepCopySupported()booleanisEstimatedSizeSupported()-
Methods inherited from class org.fusesource.hawtbuf.codec.VariableCodec
getFixedSize
-
-
-
-
Method Detail
-
encode
public void encode(T value, java.io.DataOutput dataOut) throws java.io.IOException
Description copied from interface:CodecWrite the payload of the object to the DataOutput stream.- Throws:
java.io.IOException
-
decode
public T decode(java.io.DataInput dataIn) throws java.io.IOException
Description copied from interface:CodecRead the payload of the object from the DataInput stream.- Returns:
- unmarshalled object
- Throws:
java.io.IOException
-
createBuffer
protected abstract T createBuffer(byte[] data)
-
isDeepCopySupported
public boolean isDeepCopySupported()
- Specified by:
isDeepCopySupportedin interfaceCodec<T extends Buffer>- Overrides:
isDeepCopySupportedin classVariableCodec<T extends Buffer>- Returns:
- true if the
Codec.deepCopy(Object)operations is supported.
-
isEstimatedSizeSupported
public boolean isEstimatedSizeSupported()
- Specified by:
isEstimatedSizeSupportedin interfaceCodec<T extends Buffer>- Overrides:
isEstimatedSizeSupportedin classVariableCodec<T extends Buffer>- Returns:
- true if the
Codec.estimatedSize(Object)operation is supported.
-
estimatedSize
public int estimatedSize(T object)
- Specified by:
estimatedSizein interfaceCodec<T extends Buffer>- Overrides:
estimatedSizein classVariableCodec<T extends Buffer>- Returns:
- the estimated marshaled size of the object.
-
-