Package dk.netarkivet.common.utils
Class ReadOnlyByteArray
- java.lang.Object
-
- dk.netarkivet.common.utils.ReadOnlyByteArray
-
public class ReadOnlyByteArray extends Object
Implements access to an array in a read-only fashion.
-
-
Constructor Summary
Constructors Constructor Description ReadOnlyByteArray(byte[] array)
Creates a new instance based on the given array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte
get(int index)
Gets the element at the given index.int
length()
Returns the length of the array.
-
-
-
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()
-
-