Interface ByteSequence
- All Known Implementing Classes:
AddressableByteSequence
,ExtendedByteSequence
public interface ByteSequence
An interface for accessing bytes from a byte source.
-
Method Summary
Modifier and TypeMethodDescriptionbyte
getByte
(int index) Returns the byte at the given index.byte[]
getBytes
(int start, int length) Returns a byte array containing the bytes from the given range.int
Returns the length of available bytes.boolean
hasAvailableBytes
(int index, int length) A convenience method for checking if this sequence can provide a range of bytes from some offset.
-
Method Details
-
getLength
int getLength()Returns the length of available bytes.- Returns:
- the length of the sequence of bytes
-
getByte
byte getByte(int index) Returns the byte at the given index. The index must between 0 and the extended length.- Parameters:
index
- the index in the byte sequence to retrieve a byte value- Returns:
- the byte at the given index
-
hasAvailableBytes
boolean hasAvailableBytes(int index, int length) A convenience method for checking if this sequence can provide a range of bytes from some offset.- Parameters:
index
- the index of the start of the range to check for available byteslength
- the length of the range to check for available bytes- Returns:
- true if bytes are available for the given range
-
getBytes
byte[] getBytes(int start, int length) Returns a byte array containing the bytes from the given range.- Parameters:
start
- the start index of the range to get byteslength
- the number of bytes to get- Returns:
- a byte array containing the bytes from the given range
-