Class ByteArray

  • All Implemented Interfaces:
    SizeStreamable, Streamable

    public class ByteArray
    extends java.lang.Object
    implements SizeStreamable
    Byte array with an offset and length.
    Note that the underlying byte array must not be changed as long as this instance is in use !
    Author:
    Bela Ban
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteArray​(byte[] array)  
      ByteArray​(byte[] array, int offset, int length)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ByteArray copy()  
      byte[] getArray()  
      byte[] getBytes()  
      int getLength()  
      int getOffset()  
      void readFrom​(java.io.DataInput in)
      Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
      int serializedSize()
      Returns the size (in bytes) of the marshalled object
      java.lang.String toString()  
      void writeTo​(java.io.DataOutput out)
      Write the entire state of the current object (including superclasses) to outstream.
      • Methods inherited from class java.lang.Object

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

      • ByteArray

        public ByteArray​(byte[] array,
                         int offset,
                         int length)
      • ByteArray

        public ByteArray​(byte[] array)
    • Method Detail

      • getArray

        public byte[] getArray()
      • getOffset

        public int getOffset()
      • getLength

        public int getLength()
      • getBytes

        public byte[] getBytes()
      • writeTo

        public void writeTo​(java.io.DataOutput out)
                     throws java.io.IOException
        Description copied from interface: Streamable
        Write the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed
        Specified by:
        writeTo in interface Streamable
        Throws:
        java.io.IOException
      • readFrom

        public void readFrom​(java.io.DataInput in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
        Description copied from interface: Streamable
        Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
        Specified by:
        readFrom in interface Streamable
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object