org.fusesource.hawtbuf.codec
Class VarIntegerCodec
java.lang.Object
org.fusesource.hawtbuf.codec.VarIntegerCodec
- All Implemented Interfaces:
- Codec<java.lang.Integer>
- Direct Known Subclasses:
- VarSignedIntegerCodec
public class VarIntegerCodec
- extends java.lang.Object
- implements Codec<java.lang.Integer>
Implementation of a variable length Codec for an Integer
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INSTANCE
public static final VarIntegerCodec INSTANCE
VarIntegerCodec
public VarIntegerCodec()
encode
public void encode(java.lang.Integer x,
java.io.DataOutput dataOut)
throws java.io.IOException
- Description copied from interface:
Codec
- Write the payload of the object to the DataOutput stream.
- Specified by:
encode
in interface Codec<java.lang.Integer>
- Throws:
java.io.IOException
decode
public java.lang.Integer decode(java.io.DataInput dataIn)
throws java.io.IOException
- Description copied from interface:
Codec
- Read the payload of the object from the DataInput stream.
- Specified by:
decode
in interface Codec<java.lang.Integer>
- Returns:
- unmarshalled object
- Throws:
java.io.IOException
getFixedSize
public int getFixedSize()
- Specified by:
getFixedSize
in interface Codec<java.lang.Integer>
- Returns:
- -1 if the object do not always marshall to a fixed size, otherwise return that fixed size.
deepCopy
public java.lang.Integer deepCopy(java.lang.Integer source)
- Specified by:
deepCopy
in interface Codec<java.lang.Integer>
- Returns:
- the source object since integers are immutable.
isDeepCopySupported
public boolean isDeepCopySupported()
- Specified by:
isDeepCopySupported
in interface Codec<java.lang.Integer>
- Returns:
- true if the
Codec.deepCopy(Object)
operations is supported.
isEstimatedSizeSupported
public boolean isEstimatedSizeSupported()
- Specified by:
isEstimatedSizeSupported
in interface Codec<java.lang.Integer>
- Returns:
- true if the
Codec.estimatedSize(Object)
operation is supported.
estimatedSize
public int estimatedSize(java.lang.Integer x)
- Specified by:
estimatedSize
in interface Codec<java.lang.Integer>
- Returns:
- the estimated marshaled size of the object.
Copyright © 2010-2011 FuseSource, Corp.. All Rights Reserved.