Package org.fusesource.hawtbuf.codec
Class VarSignedIntegerCodec
- java.lang.Object
-
- org.fusesource.hawtbuf.codec.VarIntegerCodec
-
- org.fusesource.hawtbuf.codec.VarSignedIntegerCodec
-
- All Implemented Interfaces:
Codec<java.lang.Integer>
public class VarSignedIntegerCodec extends VarIntegerCodec
Implementation of a variable length Codec for a signed Integer
-
-
Field Summary
Fields Modifier and Type Field Description static VarSignedIntegerCodecINSTANCE
-
Constructor Summary
Constructors Constructor Description VarSignedIntegerCodec()
-
Method Summary
All Methods Static 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.private static intdecodeZigZag(int n)voidencode(java.lang.Integer value, java.io.DataOutput dataOut)Write the payload of the object to the DataOutput stream.private static intencodeZigZag(int n)intestimatedSize(java.lang.Integer value)-
Methods inherited from class org.fusesource.hawtbuf.codec.VarIntegerCodec
deepCopy, getFixedSize, isDeepCopySupported, isEstimatedSizeSupported
-
-
-
-
Field Detail
-
INSTANCE
public static final VarSignedIntegerCodec INSTANCE
-
-
Method Detail
-
encode
public void encode(java.lang.Integer value, java.io.DataOutput dataOut) throws java.io.IOExceptionDescription copied from interface:CodecWrite the payload of the object to the DataOutput stream.- Specified by:
encodein interfaceCodec<java.lang.Integer>- Overrides:
encodein classVarIntegerCodec- Throws:
java.io.IOException
-
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.- Specified by:
decodein interfaceCodec<java.lang.Integer>- Overrides:
decodein classVarIntegerCodec- Returns:
- unmarshalled object
- Throws:
java.io.IOException
-
decodeZigZag
private static int decodeZigZag(int n)
-
encodeZigZag
private static int encodeZigZag(int n)
-
estimatedSize
public int estimatedSize(java.lang.Integer value)
- Specified by:
estimatedSizein interfaceCodec<java.lang.Integer>- Overrides:
estimatedSizein classVarIntegerCodec- Returns:
- the estimated marshaled size of the object.
-
-