Package 

Interface ByteArrayBuffer


  • 
    public interface ByteArrayBuffer
    
                        

    A simple interface that encapsulates all the information needed for byte buffer access.

    • Method Summary

      Modifier and Type Method Description
      abstract Array<byte> getBuffer() Gets the byte buffer that supports this instance.
      abstract int getOffset() Gets the offset in the byte buffer where the actual data starts.
      abstract int getLength() Gets the length of the data in the buffer.
      abstract void setLength(int len) Sets the length of the data in the buffer.
      abstract void setOffset(int off) Sets the offset of the data in the buffer.
      abstract boolean isInvalid() Perform checks on the byte buffer represented by this instance andreturn true if it is found to be invalid.
      abstract void readRegionToBuff(int off, int len, Array<byte> outBuf) Copies {@code len} bytes from the given offset in this buffer to the given {@code outBuf}
      abstract void grow(int howMuch) Increases the size of this buffer by {@code howMuch}.
      abstract void append(Array<byte> data, int len) Appends {@code len} bytes from {@code data} to the end of this buffer.
      abstract void shrink(int len) Shrinks the length of this buffer by {@code len}
      • Methods inherited from class java.lang.Object

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

      • getBuffer

         abstract Array<byte> getBuffer()

        Gets the byte buffer that supports this instance.

      • getOffset

         abstract int getOffset()

        Gets the offset in the byte buffer where the actual data starts.

      • getLength

         abstract int getLength()

        Gets the length of the data in the buffer.

      • setLength

         abstract void setLength(int len)

        Sets the length of the data in the buffer.

        Parameters:
        len - the length of the data in the buffer.
      • setOffset

         abstract void setOffset(int off)

        Sets the offset of the data in the buffer.

        Parameters:
        off - the offset of the data in the buffer.
      • isInvalid

         abstract boolean isInvalid()

        Perform checks on the byte buffer represented by this instance andreturn true if it is found to be invalid.

      • readRegionToBuff

         abstract void readRegionToBuff(int off, int len, Array<byte> outBuf)

        Copies {@code len} bytes from the given offset in this buffer to the given {@code outBuf}

        Parameters:
        off - the offset relative to the beginning of this buffer's data from where to start copying.
        len - the number of bytes to copy.
        outBuf - the array to copy to
      • grow

         abstract void grow(int howMuch)

        Increases the size of this buffer by {@code howMuch}. This may result in a new {@code byte[]} to be allocatedif the existing one is not large enough.

      • append

         abstract void append(Array<byte> data, int len)

        Appends {@code len} bytes from {@code data} to the end of this buffer. This grows the buffer and as a resulta new {@code byte[]} may be allocated.

      • shrink

         abstract void shrink(int len)

        Shrinks the length of this buffer by {@code len}