Package org.fusesource.hawtbuf.codec
Class VarSignedLongCodec
- java.lang.Object
-
- org.fusesource.hawtbuf.codec.VarLongCodec
-
- org.fusesource.hawtbuf.codec.VarSignedLongCodec
-
- All Implemented Interfaces:
Codec<java.lang.Long>
public class VarSignedLongCodec extends VarLongCodec
Implementation of a variable length Codec for a signed Long
-
-
Field Summary
Fields Modifier and Type Field Description static VarSignedLongCodec
INSTANCE
-
Constructor Summary
Constructors Constructor Description VarSignedLongCodec()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Long
decode(java.io.DataInput dataIn)
Read the payload of the object from the DataInput stream.private static long
decodeZigZag(long n)
void
encode(java.lang.Long value, java.io.DataOutput dataOut)
Write the payload of the object to the DataOutput stream.private static long
encodeZigZag(long n)
int
estimatedSize(java.lang.Long value)
-
Methods inherited from class org.fusesource.hawtbuf.codec.VarLongCodec
deepCopy, getFixedSize, isDeepCopySupported, isEstimatedSizeSupported
-
-
-
-
Field Detail
-
INSTANCE
public static final VarSignedLongCodec INSTANCE
-
-
Method Detail
-
encode
public void encode(java.lang.Long 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.Long>
- Overrides:
encode
in classVarLongCodec
- Throws:
java.io.IOException
-
decode
public java.lang.Long 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.Long>
- Overrides:
decode
in classVarLongCodec
- Returns:
- unmarshalled object
- Throws:
java.io.IOException
-
decodeZigZag
private static long decodeZigZag(long n)
-
encodeZigZag
private static long encodeZigZag(long n)
-
estimatedSize
public int estimatedSize(java.lang.Long value)
- Specified by:
estimatedSize
in interfaceCodec<java.lang.Long>
- Overrides:
estimatedSize
in classVarLongCodec
- Returns:
- the estimated marshaled size of the object.
-
-