Package ghidra.app.util.bin

# Class ObfuscatedFileByteProvider

java.lang.Object
ghidra.app.util.bin.FileByteProvider
ghidra.app.util.bin.ObfuscatedFileByteProvider

All Implemented Interfaces:
  `ByteProvider`, `MutableByteProvider`, `Closeable`, `AutoCloseable`

public class ObfuscatedFileByteProvider extends FileByteProvider
A `ByteProvider` that reads from an on-disk file, but obfuscates / de-obfuscates the contents of the file when reading / writing.

- ## Field Summary

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

  `EMPTY_BYTEPROVIDER`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ObfuscatedFileByteProvider(File file, FSRL fsrl, AccessMode accessMode)`
  Creates an instance of `ObfuscatedFileByteProvider`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected int`
  `doReadBytes(long index, byte[] buffer)`
  Reads bytes from the file.
  `protected void`
  `doWriteBytes(long index, byte[] buffer, int offset, int length)`
  Writes the specified bytes to the file.
  `File`
  `getFile()`
  Returns the underlying `File` for this `ByteProvider`, or null if this `ByteProvider` is not associated with a `File`.

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

  `close, finalize, getAbsolutePath, getAccessMode, getFSRL, getName, isValidIndex, length, readByte, readBytes, readBytes, writeByte, writeBytes, writeBytes`

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

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

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

  `getInputStream, isEmpty`

- ## Constructor Details

  - ### ObfuscatedFileByteProvider

    public ObfuscatedFileByteProvider(File file, FSRL fsrl, AccessMode accessMode) throws IOException
    Creates an instance of `ObfuscatedFileByteProvider`.
    Parameters:
      `file` - `File` to read from / write to
      `fsrl` - `FSRL` identity of this file
      `accessMode` - `AccessMode.READ` or `AccessMode.WRITE`
    Throws:
      `IOException` - if error

- ## Method Details

  - ### getFile

    public File getFile()
    Description copied from interface: `ByteProvider`
    Returns the underlying `File` for this `ByteProvider`, or null if this `ByteProvider` is not associated with a `File`.
    Specified by:
      `getFile` in interface `ByteProvider`
    Overrides:
      `getFile` in class `FileByteProvider`
    Returns:
      the underlying file for this byte provider

  - ### doReadBytes

    protected int doReadBytes(long index, byte[] buffer) throws IOException
    Description copied from class: `FileByteProvider`
    Reads bytes from the file.

    Protected by synchronized lock. (See `FileByteProvider.getBufferFor(long)`).

    Overrides:
      `doReadBytes` in class `FileByteProvider`
    Parameters:
      `index` - file position of where to read
      `buffer` - byte array that will receive bytes
    Returns:
      actual number of byte read
    Throws:
      `IOException` - if error

  - ### doWriteBytes

    protected void doWriteBytes(long index, byte[] buffer, int offset, int length) throws IOException
    Description copied from class: `FileByteProvider`
    Writes the specified bytes to the file.

    Protected by synchronized lock (See `FileByteProvider.writeBytes(long, byte[], int, int)`)

    Overrides:
      `doWriteBytes` in class `FileByteProvider`
    Parameters:
      `index` - file position of where to write
      `buffer` - byte array containing bytes to write
      `offset` - offset inside of byte array to start
      `length` - number of bytes from buffer to write
    Throws:
      `IOException` - if error