Package org.fusesource.hawtbuf.codec
Class VariableCodec<T>
- java.lang.Object
-
- org.fusesource.hawtbuf.codec.VariableCodec<T>
-
- Type Parameters:
T
-
- All Implemented Interfaces:
Codec<T>
- Direct Known Subclasses:
AbstractBufferCodec
,ObjectCodec
,PBMessageFramedCodec
,PBMessageUnframedCodec
public abstract class VariableCodec<T> extends java.lang.Object implements Codec<T>
Convenience base class for Marshaller implementations which do not deepCopy and which use variable size encodings.
-
-
Constructor Summary
Constructors Constructor Description VariableCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
deepCopy(T source)
int
estimatedSize(T object)
int
getFixedSize()
boolean
isDeepCopySupported()
boolean
isEstimatedSizeSupported()
-
-
-
Method Detail
-
getFixedSize
public int getFixedSize()
- Specified by:
getFixedSize
in interfaceCodec<T>
- Returns:
- -1 if the object do not always marshall to a fixed size, otherwise return that fixed size.
-
isDeepCopySupported
public boolean isDeepCopySupported()
- Specified by:
isDeepCopySupported
in interfaceCodec<T>
- Returns:
- true if the
Codec.deepCopy(Object)
operations is supported.
-
isEstimatedSizeSupported
public boolean isEstimatedSizeSupported()
- Specified by:
isEstimatedSizeSupported
in interfaceCodec<T>
- Returns:
- true if the
Codec.estimatedSize(Object)
operation is supported.
-
estimatedSize
public int estimatedSize(T object)
- Specified by:
estimatedSize
in interfaceCodec<T>
- Returns:
- the estimated marshaled size of the object.
-
-