Class FixedBufferCodec

  • All Implemented Interfaces:
    Codec<Buffer>

    public class FixedBufferCodec
    extends java.lang.Object
    implements Codec<Buffer>
    Implementation of a Marshaller for Buffer objects
    • Field Detail

      • size

        private final int size
    • Constructor Detail

      • FixedBufferCodec

        public FixedBufferCodec​(int size)
    • Method Detail

      • encode

        public void encode​(Buffer 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<Buffer>
        Throws:
        java.io.IOException
      • decode

        public Buffer 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<Buffer>
        Returns:
        unmarshalled object
        Throws:
        java.io.IOException
      • getFixedSize

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

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

        public int estimatedSize​(Buffer object)
        Specified by:
        estimatedSize in interface Codec<Buffer>
        Returns:
        the estimated marshaled size of the object.