Package org.fusesource.hawtbuf.proto
Class PBMessageUnframedCodec<T extends MessageBuffer>
- java.lang.Object
-
- org.fusesource.hawtbuf.codec.VariableCodec<T>
-
- org.fusesource.hawtbuf.proto.PBMessageUnframedCodec<T>
-
- All Implemented Interfaces:
Codec<T>
public class PBMessageUnframedCodec<T extends MessageBuffer> extends VariableCodec<T>
Implements the Codec interface for PBMessages type which encode/decodes unframed messages.
-
-
Field Summary
Fields Modifier and Type Field Description private PBMessageFactory<?,? extends T>
factory
-
Constructor Summary
Constructors Constructor Description PBMessageUnframedCodec(PBMessageFactory<?,? extends T> factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
decode(java.io.DataInput dataIn)
Read the payload of the object from the DataInput stream.T
deepCopy(T value)
void
encode(T value, java.io.DataOutput dataOut)
Write the payload of the object to the DataOutput stream.int
estimatedSize(T value)
boolean
isDeepCopySupported()
boolean
isEstimatedSizeSupported()
-
Methods inherited from class org.fusesource.hawtbuf.codec.VariableCodec
getFixedSize
-
-
-
-
Field Detail
-
factory
private final PBMessageFactory<?,? extends T extends MessageBuffer> factory
-
-
Constructor Detail
-
PBMessageUnframedCodec
public PBMessageUnframedCodec(PBMessageFactory<?,? extends T> factory)
-
-
Method Detail
-
decode
public T decode(java.io.DataInput dataIn) throws java.io.IOException
Description copied from interface:Codec
Read the payload of the object from the DataInput stream.- Returns:
- unmarshalled object
- Throws:
java.io.IOException
-
encode
public void encode(T value, java.io.DataOutput dataOut) throws java.io.IOException
Description copied from interface:Codec
Write the payload of the object to the DataOutput stream.- Throws:
java.io.IOException
-
isEstimatedSizeSupported
public boolean isEstimatedSizeSupported()
- Specified by:
isEstimatedSizeSupported
in interfaceCodec<T extends MessageBuffer>
- Overrides:
isEstimatedSizeSupported
in classVariableCodec<T extends MessageBuffer>
- Returns:
- true if the
Codec.estimatedSize(Object)
operation is supported.
-
estimatedSize
public int estimatedSize(T value)
- Specified by:
estimatedSize
in interfaceCodec<T extends MessageBuffer>
- Overrides:
estimatedSize
in classVariableCodec<T extends MessageBuffer>
- Returns:
- the estimated marshaled size of the object.
-
isDeepCopySupported
public boolean isDeepCopySupported()
- Specified by:
isDeepCopySupported
in interfaceCodec<T extends MessageBuffer>
- Overrides:
isDeepCopySupported
in classVariableCodec<T extends MessageBuffer>
- Returns:
- true if the
Codec.deepCopy(Object)
operations is supported.
-
deepCopy
public T deepCopy(T value)
- Specified by:
deepCopy
in interfaceCodec<T extends MessageBuffer>
- Overrides:
deepCopy
in classVariableCodec<T extends MessageBuffer>
- Returns:
- a deep copy of the source object. If the source is immutable the same source should be returned.
-
-