Class BytesCodec

  • All Implemented Interfaces:
    Codec<byte[]>

    public class BytesCodec
    extends java.lang.Object
    implements Codec<byte[]>
    Implementation of a Marshaller for byte arrays
    • Constructor Summary

      Constructors 
      Constructor Description
      BytesCodec()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] decode​(java.io.DataInput dataIn)
      Read the payload of the object from the DataInput stream.
      byte[] deepCopy​(byte[] source)  
      void encode​(byte[] data, java.io.DataOutput dataOut)
      Write the payload of the object to the DataOutput stream.
      int estimatedSize​(byte[] 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
    • Field Detail

      • INSTANCE

        public static final BytesCodec INSTANCE
    • Constructor Detail

      • BytesCodec

        public BytesCodec()
    • Method Detail

      • encode

        public void encode​(byte[] data,
                           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<byte[]>
        Throws:
        java.io.IOException
      • decode

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

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

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

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