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 VarSignedLongCodecINSTANCE
-
Constructor Summary
Constructors Constructor Description VarSignedLongCodec()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Longdecode(java.io.DataInput dataIn)Read the payload of the object from the DataInput stream.private static longdecodeZigZag(long n)voidencode(java.lang.Long value, java.io.DataOutput dataOut)Write the payload of the object to the DataOutput stream.private static longencodeZigZag(long n)intestimatedSize(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.IOExceptionDescription copied from interface:CodecWrite the payload of the object to the DataOutput stream.- Specified by:
encodein interfaceCodec<java.lang.Long>- Overrides:
encodein classVarLongCodec- Throws:
java.io.IOException
-
decode
public java.lang.Long 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.Long>- Overrides:
decodein 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:
estimatedSizein interfaceCodec<java.lang.Long>- Overrides:
estimatedSizein classVarLongCodec- Returns:
- the estimated marshaled size of the object.
-
-