Class ByteString.BoundedByteString

    • Field Detail

      • bytesOffset

        private final int bytesOffset
      • bytesLength

        private final int bytesLength
    • Constructor Detail

      • BoundedByteString

        BoundedByteString​(byte[] bytes,
                          int offset,
                          int length)
        Creates a BoundedByteString backed by the sub-range of given array, without copying.
        Parameters:
        bytes - array to wrap
        offset - index to first byte to use in bytes
        length - number of bytes to use from bytes
        Throws:
        java.lang.IllegalArgumentException - if offset < 0, length < 0, or if offset + length > bytes.length.
    • Method Detail

      • byteAt

        public byte byteAt​(int index)
        Gets the byte at the given index. Throws ArrayIndexOutOfBoundsException for backwards-compatibility reasons although it would more properly be IndexOutOfBoundsException.
        Overrides:
        byteAt in class ByteString.LiteralByteString
        Parameters:
        index - index of byte
        Returns:
        the value
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - index is < 0 or >= size
      • internalByteAt

        byte internalByteAt​(int index)
        Description copied from class: ByteString
        Gets the byte at the given index, assumes bounds checking has already been performed.
        Overrides:
        internalByteAt in class ByteString.LiteralByteString
        Parameters:
        index - index of byte
        Returns:
        the value
      • writeReplace

        java.lang.Object writeReplace()
      • readObject

        private void readObject​(java.io.ObjectInputStream in)
                         throws java.io.IOException
        Throws:
        java.io.IOException