Package 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
-
-
Field Summary
Fields Modifier and Type Field Description static VarIntegerCodecINSTANCE
-
Constructor Summary
Constructors Constructor Description VarIntegerCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Integerdecode(java.io.DataInput dataIn)Read the payload of the object from the DataInput stream.java.lang.IntegerdeepCopy(java.lang.Integer source)voidencode(java.lang.Integer x, java.io.DataOutput dataOut)Write the payload of the object to the DataOutput stream.intestimatedSize(java.lang.Integer x)intgetFixedSize()booleanisDeepCopySupported()booleanisEstimatedSizeSupported()
-
-
-
Field Detail
-
INSTANCE
public static final VarIntegerCodec INSTANCE
-
-
Method Detail
-
encode
public void encode(java.lang.Integer x, java.io.DataOutput dataOut) throws java.io.IOExceptionDescription copied from interface:CodecWrite the payload of the object to the DataOutput stream.
-
decode
public java.lang.Integer decode(java.io.DataInput dataIn) throws java.io.IOExceptionDescription copied from interface:CodecRead the payload of the object from the DataInput stream.
-
getFixedSize
public int getFixedSize()
- Specified by:
getFixedSizein interfaceCodec<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)
-
isDeepCopySupported
public boolean isDeepCopySupported()
- Specified by:
isDeepCopySupportedin interfaceCodec<java.lang.Integer>- Returns:
- true if the
Codec.deepCopy(Object)operations is supported.
-
isEstimatedSizeSupported
public boolean isEstimatedSizeSupported()
- Specified by:
isEstimatedSizeSupportedin interfaceCodec<java.lang.Integer>- Returns:
- true if the
Codec.estimatedSize(Object)operation is supported.
-
estimatedSize
public int estimatedSize(java.lang.Integer x)
- Specified by:
estimatedSizein interfaceCodec<java.lang.Integer>- Returns:
- the estimated marshaled size of the object.
-
-