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
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
ConstructorsConstructorDescriptionObfuscatedFileByteProvider(File file, FSRL fsrl, AccessMode accessMode) Creates an instance ofObfuscatedFileByteProvider. -
Method Summary
Modifier and TypeMethodDescriptionprotected intdoReadBytes(long index, byte[] buffer) Reads bytes from the file.protected voiddoWriteBytes(long index, byte[] buffer, int offset, int length) Writes the specified bytes to the file.getFile()Returns the underlyingFilefor thisByteProvider, or null if thisByteProvideris not associated with aFile.Methods inherited from class ghidra.app.util.bin.FileByteProvider
close, finalize, getAbsolutePath, getAccessMode, getFSRL, getName, isValidIndex, length, readByte, readBytes, readBytes, writeByte, writeBytes, writeBytesMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.app.util.bin.ByteProvider
getInputStream, isEmpty
-
Constructor Details
-
ObfuscatedFileByteProvider
Creates an instance ofObfuscatedFileByteProvider.- Parameters:
file-Fileto read from / write tofsrl-FSRLidentity of this fileaccessMode-AccessMode.READorAccessMode.WRITE- Throws:
IOException- if error
-
-
Method Details
-
getFile
Description copied from interface:ByteProviderReturns the underlyingFilefor thisByteProvider, or null if thisByteProvideris not associated with aFile.- Specified by:
getFilein interfaceByteProvider- Overrides:
getFilein classFileByteProvider- Returns:
- the underlying file for this byte provider
-
doReadBytes
Description copied from class:FileByteProviderReads bytes from the file.Protected by synchronized lock. (See
FileByteProvider.getBufferFor(long)).- Overrides:
doReadBytesin classFileByteProvider- Parameters:
index- file position of where to readbuffer- byte array that will receive bytes- Returns:
- actual number of byte read
- Throws:
IOException- if error
-
doWriteBytes
Description copied from class:FileByteProviderWrites the specified bytes to the file.Protected by synchronized lock (See
FileByteProvider.writeBytes(long, byte[], int, int))- Overrides:
doWriteBytesin classFileByteProvider- Parameters:
index- file position of where to writebuffer- byte array containing bytes to writeoffset- offset inside of byte array to startlength- number of bytes from buffer to write- Throws:
IOException- if error
-