Class ByteArrayByteBank

    • Constructor Detail

      • ByteArrayByteBank

        public ByteArrayByteBank​(int initialCapacity)
        Creates a ByteArrayByteBank with the specified initial capacity.
        Parameters:
        initialCapacity - the initial capacity of this ByteBank
      • ByteArrayByteBank

        public ByteArrayByteBank​(byte[] bytes)
        Creates a ByteArrayByteBank that wraps the provided byte array.
        Parameters:
        bytes - the bytes to wrap
    • Method Detail

      • getMaxBufferSize

        public long getMaxBufferSize()
        Specified by:
        getMaxBufferSize in interface ByteBank
        Returns:
        the maximal size of the buffer
      • setBytes

        public void setBytes​(long startpos,
                             byte[] bytes,
                             int offset,
                             int length)
        Description copied from interface: ByteBank
        Sets the bytes starting form the given position to the values form the provided array.
        Specified by:
        setBytes in interface ByteBank
        Parameters:
        startpos - the position in the buffer to start writing from
        bytes - the byte array to write
        offset - the offset in the bytes array
        length - the number of bytes to read
      • setByte

        public void setByte​(long pos,
                            byte b)
        Description copied from interface: ByteBank
        Sets the byte at the given position
        Specified by:
        setByte in interface ByteBank
        Parameters:
        pos - the position
        b - the value to set
      • clear

        public void clear()
        Description copied from interface: ByteBank
        Clears the buffer
        Specified by:
        clear in interface ByteBank
      • getByte

        public byte getByte​(long pos)
        Specified by:
        getByte in interface ByteBank
        Parameters:
        pos - the position to read from
        Returns:
        the byte at the given position
      • getBytes

        public int getBytes​(long startPos,
                            byte[] b,
                            int offset,
                            int length)
        Specified by:
        getBytes in interface ByteBank
        Parameters:
        startPos - the position in the buffer to start reading from
        b - the byte array to read into
        offset - the offset in the bytes array
        length - the number of elements to read into the bytes array
        Returns:
        number of bytes read
      • size

        public long size()
        Specified by:
        size in interface ByteBank
        Returns:
        the offset which follows the last byte stored in this ByteBank