Class VarLongCodec

  • All Implemented Interfaces:
    Codec<java.lang.Long>
    Direct Known Subclasses:
    VarSignedLongCodec

    public class VarLongCodec
    extends java.lang.Object
    implements Codec<java.lang.Long>
    Implementation of a variable length Codec for a Long
    • Constructor Summary

      Constructors 
      Constructor Description
      VarLongCodec()  
    • Method Summary

      All 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.
      java.lang.Long deepCopy​(java.lang.Long source)  
      void encode​(java.lang.Long object, java.io.DataOutput dataOut)
      Write the payload of the object to the DataOutput stream.
      int estimatedSize​(java.lang.Long object)  
      int getFixedSize()  
      boolean isDeepCopySupported()  
      boolean isEstimatedSizeSupported()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • VarLongCodec

        public VarLongCodec()
    • Method Detail

      • encode

        public void encode​(java.lang.Long object,
                           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.Long>
        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 interface Codec<java.lang.Long>
        Returns:
        unmarshalled object
        Throws:
        java.io.IOException
      • estimatedSize

        public int estimatedSize​(java.lang.Long object)
        Specified by:
        estimatedSize in interface Codec<java.lang.Long>
        Returns:
        the estimated marshaled size of the object.
      • getFixedSize

        public int getFixedSize()
        Specified by:
        getFixedSize in interface Codec<java.lang.Long>
        Returns:
        -1 if the object do not always marshall to a fixed size, otherwise return that fixed size.
      • deepCopy

        public java.lang.Long deepCopy​(java.lang.Long source)
        Specified by:
        deepCopy in interface Codec<java.lang.Long>
        Returns:
        a deep copy of the source object. If the source is immutable the same source should be returned.