Package org.fusesource.hawtbuf.codec
Class VarSignedIntegerCodec
java.lang.Object
org.fusesource.hawtbuf.codec.VarIntegerCodec
org.fusesource.hawtbuf.codec.VarSignedIntegerCodec
Implementation of a variable length Codec for a signed Integer
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRead the payload of the object from the DataInput stream.private static int
decodeZigZag
(int n) void
encode
(Integer value, DataOutput dataOut) Write the payload of the object to the DataOutput stream.private static int
encodeZigZag
(int n) int
estimatedSize
(Integer value) Methods inherited from class org.fusesource.hawtbuf.codec.VarIntegerCodec
deepCopy, getFixedSize, isDeepCopySupported, isEstimatedSizeSupported
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
VarSignedIntegerCodec
public VarSignedIntegerCodec()
-
-
Method Details
-
encode
Description copied from interface:Codec
Write the payload of the object to the DataOutput stream.- Specified by:
encode
in interfaceCodec<Integer>
- Overrides:
encode
in classVarIntegerCodec
- Parameters:
value
-dataOut
-- Throws:
IOException
-
decode
Description copied from interface:Codec
Read the payload of the object from the DataInput stream.- Specified by:
decode
in interfaceCodec<Integer>
- Overrides:
decode
in classVarIntegerCodec
- Parameters:
dataIn
-- Returns:
- unmarshalled object
- Throws:
IOException
-
decodeZigZag
private static int decodeZigZag(int n) -
encodeZigZag
private static int encodeZigZag(int n) -
estimatedSize
- Specified by:
estimatedSize
in interfaceCodec<Integer>
- Overrides:
estimatedSize
in classVarIntegerCodec
- Parameters:
value
-- Returns:
- the estimated marshaled size of the object.
-