Package ghidra.util.bytesearch
Class InputStreamBufferByteSequence
java.lang.Object
ghidra.util.bytesearch.InputStreamBufferByteSequence
- All Implemented Interfaces:
ByteSequence
ByteSequence that buffers an
InputStream-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbytegetByte(int index) Returns the byte at the given index.byte[]getBytes(int index, int length) Returns a byte array containing the bytes from the given range.intReturns the length of available bytes.booleanhasAvailableBytes(int index, int length) A convenience method for checking if this sequence can provide a range of bytes from some offset.voidload(InputStream is, int amount) Loads data into this byte sequence from the given input stream
-
Constructor Details
-
InputStreamBufferByteSequence
public InputStreamBufferByteSequence(int bufferSize)
-
-
Method Details
-
load
Loads data into this byte sequence from the given input stream- Parameters:
is- the input stream to read bytes fromamount- the number of bytes to read from the stream- Throws:
IOException- if an error occurs reading from the stream
-
getLength
public int getLength()Description copied from interface:ByteSequenceReturns the length of available bytes.- Specified by:
getLengthin interfaceByteSequence- Returns:
- the length of the sequence of bytes
-
getByte
public byte getByte(int index) Description copied from interface:ByteSequenceReturns the byte at the given index. The index must between 0 and the extended length.- Specified by:
getBytein interfaceByteSequence- Parameters:
index- the index in the byte sequence to retrieve a byte value- Returns:
- the byte at the given index
-
hasAvailableBytes
public boolean hasAvailableBytes(int index, int length) Description copied from interface:ByteSequenceA convenience method for checking if this sequence can provide a range of bytes from some offset.- Specified by:
hasAvailableBytesin interfaceByteSequence- 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
public byte[] getBytes(int index, int length) Description copied from interface:ByteSequenceReturns a byte array containing the bytes from the given range.- Specified by:
getBytesin interfaceByteSequence- Parameters:
index- 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
-