Package ghidra.app.util.bin
Class UnlimitedByteProviderWrapper
java.lang.Object
ghidra.app.util.bin.ByteProviderWrapper
ghidra.app.util.bin.UnlimitedByteProviderWrapper
- All Implemented Interfaces:
ByteProvider,Closeable,AutoCloseable
A
ByteProvider constrained to a sub-section of an existing ByteProvider
although reads beyond the specified sub-section are permitted but will return zero byte
values. The methods ByteProviderWrapper.length() and ByteProvider.getInputStream(long) remain
bounded by the specified sub-section.-
Field Summary
Fields inherited from class ghidra.app.util.bin.ByteProviderWrapper
fsrl, provider, subLength, subOffsetFields inherited from interface ghidra.app.util.bin.ByteProvider
EMPTY_BYTEPROVIDER -
Constructor Summary
ConstructorsConstructorDescriptionUnlimitedByteProviderWrapper(ByteProvider provider) Creates a wrapper around aByteProviderthat contains the same bytes as the specified provider.UnlimitedByteProviderWrapper(ByteProvider provider, long subOffset, long subLength) Constructs aUnlimitedByteProviderWrapperaround the specifiedByteProvider, constrained to a subsection of the provider.UnlimitedByteProviderWrapper(ByteProvider provider, long subOffset, long subLength, FSRL fsrl) Constructs aUnlimitedByteProviderWrapperaround the specifiedByteProvider, constrained to a subsection of the provider.UnlimitedByteProviderWrapper(ByteProvider provider, FSRL fsrl) Creates a wrapper around aByteProviderthat contains the same bytes as the specified provider, but with a newFSRLidentity. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisValidIndex(long index) Returns true if the specified index is valid.bytereadByte(long index) Reads a byte at the specified indexbyte[]readBytes(long index, long length) Reads a byte array at the specified indexMethods inherited from class ghidra.app.util.bin.ByteProviderWrapper
close, getAbsolutePath, getFile, getFSRL, getName, lengthMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.app.util.bin.ByteProvider
getInputStream, isEmpty
-
Constructor Details
-
UnlimitedByteProviderWrapper
Creates a wrapper around aByteProviderthat contains the same bytes as the specified provider.- Parameters:
provider-ByteProviderto wrap- Throws:
IOException- if error
-
UnlimitedByteProviderWrapper
Creates a wrapper around aByteProviderthat contains the same bytes as the specified provider, but with a newFSRLidentity.- Parameters:
provider-ByteProviderto wrapfsrl-FSRLidentity for the instance- Throws:
IOException- if error
-
UnlimitedByteProviderWrapper
Constructs aUnlimitedByteProviderWrapperaround the specifiedByteProvider, constrained to a subsection of the provider.- Parameters:
provider- theByteProviderto wrapsubOffset- the offset in theByteProviderof where to start the newUnlimitedByteProviderWrappersubLength- the length of the newUnlimitedByteProviderWrapper
-
UnlimitedByteProviderWrapper
public UnlimitedByteProviderWrapper(ByteProvider provider, long subOffset, long subLength, FSRL fsrl) Constructs aUnlimitedByteProviderWrapperaround the specifiedByteProvider, constrained to a subsection of the provider.- Parameters:
provider- theByteProviderto wrapsubOffset- the offset in theByteProviderof where to start the newUnlimitedByteProviderWrappersubLength- the length of the newUnlimitedByteProviderWrapperfsrl-FSRLidentity of the file this ByteProvider represents
-
-
Method Details
-
isValidIndex
public boolean isValidIndex(long index) Description copied from interface:ByteProviderReturns true if the specified index is valid.- Specified by:
isValidIndexin interfaceByteProvider- Overrides:
isValidIndexin classByteProviderWrapper- Parameters:
index- the index in the byte provider to check- Returns:
- true if the specified index is valid
-
readByte
Description copied from interface:ByteProviderReads a byte at the specified index- Specified by:
readBytein interfaceByteProvider- Overrides:
readBytein classByteProviderWrapper- Parameters:
index- the index of the byte to read- Returns:
- the byte read from the specified index
- Throws:
IOException- if an I/O error occurs
-
readBytes
Description copied from interface:ByteProviderReads a byte array at the specified index- Specified by:
readBytesin interfaceByteProvider- Overrides:
readBytesin classByteProviderWrapper- Parameters:
index- the index of the byte to readlength- the number of bytes to read- Returns:
- the byte array read from the specified index
- Throws:
IOException- if an I/O error occurs
-