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`

public class UnlimitedByteProviderWrapper extends ByteProviderWrapper
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, subOffset`

  ### Fields inherited from interface ghidra.app.util.bin.ByteProvider

  `EMPTY_BYTEPROVIDER`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UnlimitedByteProviderWrapper(ByteProvider provider)`
  Creates a wrapper around a `ByteProvider` that contains the same bytes as the specified provider.
  `UnlimitedByteProviderWrapper(ByteProvider provider, long subOffset, long subLength)`
  Constructs a `UnlimitedByteProviderWrapper` around the specified `ByteProvider`, constrained to a subsection of the provider.
  `UnlimitedByteProviderWrapper(ByteProvider provider, long subOffset, long subLength, FSRL fsrl)`
  Constructs a `UnlimitedByteProviderWrapper` around the specified `ByteProvider`, constrained to a subsection of the provider.
  `UnlimitedByteProviderWrapper(ByteProvider provider, FSRL fsrl)`
  Creates a wrapper around a `ByteProvider` that contains the same bytes as the specified provider, but with a new `FSRL` identity.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isValidIndex(long index)`
  Returns true if the specified index is valid.
  `byte`
  `readByte(long index)`
  Reads a byte at the specified index
  `byte[]`
  `readBytes(long index, long length)`
  Reads a byte array at the specified index

  ### Methods inherited from class ghidra.app.util.bin.ByteProviderWrapper

  `close, getAbsolutePath, getFile, getFSRL, getName, length`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface ghidra.app.util.bin.ByteProvider

  `getInputStream, isEmpty`

- ## Constructor Details

  - ### UnlimitedByteProviderWrapper

    public UnlimitedByteProviderWrapper(ByteProvider provider) throws IOException
    Creates a wrapper around a `ByteProvider` that contains the same bytes as the specified provider.

    Parameters:
      `provider` - `ByteProvider` to wrap
    Throws:
      `IOException` - if error

  - ### UnlimitedByteProviderWrapper

    public UnlimitedByteProviderWrapper(ByteProvider provider, FSRL fsrl) throws IOException
    Creates a wrapper around a `ByteProvider` that contains the same bytes as the specified provider, but with a new `FSRL` identity.

    Parameters:
      `provider` - `ByteProvider` to wrap
      `fsrl` - `FSRL` identity for the instance
    Throws:
      `IOException` - if error

  - ### UnlimitedByteProviderWrapper

    public UnlimitedByteProviderWrapper(ByteProvider provider, long subOffset, long subLength)
    Constructs a `UnlimitedByteProviderWrapper` around the specified `ByteProvider`, constrained to a subsection of the provider.
    Parameters:
      `provider` - the `ByteProvider` to wrap
      `subOffset` - the offset in the `ByteProvider` of where to start the new `UnlimitedByteProviderWrapper`
      `subLength` - the length of the new `UnlimitedByteProviderWrapper`

  - ### UnlimitedByteProviderWrapper

    public UnlimitedByteProviderWrapper(ByteProvider provider, long subOffset, long subLength, FSRL fsrl)
    Constructs a `UnlimitedByteProviderWrapper` around the specified `ByteProvider`, constrained to a subsection of the provider.
    Parameters:
      `provider` - the `ByteProvider` to wrap
      `subOffset` - the offset in the `ByteProvider` of where to start the new `UnlimitedByteProviderWrapper`
      `subLength` - the length of the new `UnlimitedByteProviderWrapper`
      `fsrl` - `FSRL` identity of the file this ByteProvider represents

- ## Method Details

  - ### isValidIndex

    public boolean isValidIndex(long index)
    Description copied from interface: `ByteProvider`
    Returns true if the specified index is valid.
    Specified by:
      `isValidIndex` in interface `ByteProvider`
    Overrides:
      `isValidIndex` in class `ByteProviderWrapper`
    Parameters:
      `index` - the index in the byte provider to check
    Returns:
      true if the specified index is valid

  - ### readByte

    public byte readByte(long index) throws IOException
    Description copied from interface: `ByteProvider`
    Reads a byte at the specified index
    Specified by:
      `readByte` in interface `ByteProvider`
    Overrides:
      `readByte` in class `ByteProviderWrapper`
    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

    public byte[] readBytes(long index, long length) throws IOException
    Description copied from interface: `ByteProvider`
    Reads a byte array at the specified index
    Specified by:
      `readBytes` in interface `ByteProvider`
    Overrides:
      `readBytes` in class `ByteProviderWrapper`
    Parameters:
      `index` - the index of the byte to read
      `length` - the number of bytes to read
    Returns:
      the byte array read from the specified index
    Throws:
      `IOException` - if an I/O error occurs