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 Object
- implements Codec<T>
Convenience base class for Marshaller implementations which do not deepCopy and
which use variable size encodings.
- Author:
- chirino
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VariableCodec
public VariableCodec()
getFixedSize
public int getFixedSize()
- Specified by:
getFixedSize
in interface Codec<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 interface Codec<T>
- Returns:
- true if the
Codec.deepCopy(Object)
operations is supported.
deepCopy
public T deepCopy(T source)
- Specified by:
deepCopy
in interface Codec<T>
- Returns:
- a deep copy of the source object. If the source is immutable
the same source should be returned.
isEstimatedSizeSupported
public boolean isEstimatedSizeSupported()
- Specified by:
isEstimatedSizeSupported
in interface Codec<T>
- Returns:
- true if the
Codec.estimatedSize(Object)
operation is supported.
estimatedSize
public int estimatedSize(T object)
- Specified by:
estimatedSize
in interface Codec<T>
- Returns:
- the estimated marshaled size of the object.
Copyright © 2010-2014 FuseSource, Corp.. All Rights Reserved.