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 VarSignedIntegerCodec
INSTANCE
-
Constructor Summary
Constructors Constructor Description VarSignedIntegerCodec()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Integer
decode(java.io.DataInput dataIn)
Read the payload of the object from the DataInput stream.private static int
decodeZigZag(int n)
void
encode(java.lang.Integer value, java.io.DataOutput dataOut)
Write the payload of the object to the DataOutput stream.private static int
encodeZigZag(int n)
int
estimatedSize(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.IOException
Description copied from interface:Codec
Write the payload of the object to the DataOutput stream.- Specified by:
encode
in interfaceCodec<java.lang.Integer>
- Overrides:
encode
in classVarIntegerCodec
- 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 interfaceCodec<java.lang.Integer>
- Overrides:
decode
in 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:
estimatedSize
in interfaceCodec<java.lang.Integer>
- Overrides:
estimatedSize
in classVarIntegerCodec
- Returns:
- the estimated marshaled size of the object.
-
-