Class ReadOnlyByteArray


  • public class ReadOnlyByteArray
    extends Object
    Implements access to an array in a read-only fashion.
    • Constructor Detail

      • ReadOnlyByteArray

        public ReadOnlyByteArray​(byte[] array)
        Creates a new instance based on the given array.
        Parameters:
        array - Array to provide read-only access to. The array will not be copied by this class.
    • Method Detail

      • length

        public int length()
        Returns the length of the array.
        Returns:
        The length of the array. Always >= 0.
      • get

        public byte get​(int index)
        Gets the element at the given index.
        Parameters:
        index - The index to get the element at.
        Returns:
        The byte at the given index.
        Throws:
        IndexOutOfBoundsException - if the index is < 0 or > length()