Class VarSignedIntegerCodec

  • All Implemented Interfaces:
    Codec<java.lang.Integer>

    public class VarSignedIntegerCodec
    extends VarIntegerCodec
    Implementation of a variable length Codec for a signed Integer
    • Constructor Detail

      • VarSignedIntegerCodec

        public VarSignedIntegerCodec()
    • 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 interface Codec<java.lang.Integer>
        Overrides:
        encode in class VarIntegerCodec
        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 interface Codec<java.lang.Integer>
        Overrides:
        decode in class VarIntegerCodec
        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 interface Codec<java.lang.Integer>
        Overrides:
        estimatedSize in class VarIntegerCodec
        Returns:
        the estimated marshaled size of the object.