Package ghidra.formats.gfilesystem
Class SingleFileSystemIndexHelper
java.lang.Object
ghidra.formats.gfilesystem.SingleFileSystemIndexHelper
A helper class used by GFilesystem implementors that have a single file to handle lookups
and requests for that file.
This class is patterned on FileSystemIndexHelper and has pretty much the same api.
-
Constructor Summary
ConstructorDescriptionSingleFileSystemIndexHelper
(GFileSystem fs, FSRLRoot fsFSRL, String payloadFilename, long length, String payloadMD5) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the data held by this object.int
Number of files in this index.getListing
(GFile directory) Mirror'sGFileSystem.getListing(GFile)
interface.Gets the 'payload' file, ie.Gets the rootGFile
object for this filesystem index.Gets the root dir's FSRL.boolean
isClosed()
Returns true if this object has beenclear()
'ed.boolean
isPayloadFile
(GFile file) Returns true if the specified file is the payload file.lookup
(GFile baseDir, String path, Comparator<String> nameComp) Mirror'sGFileSystem.lookup(String)
interface.Mirror'sGFileSystem.lookup(String)
interface.toString()
-
Constructor Details
-
SingleFileSystemIndexHelper
public SingleFileSystemIndexHelper(GFileSystem fs, FSRLRoot fsFSRL, String payloadFilename, long length, String payloadMD5) Creates a new instance. A "root" directory GFile will be auto-created for the filesystem.- Parameters:
fs
- theGFileSystem
that this index will be for.fsFSRL
- thefsrl
of the filesystem itself. (this parameter is explicitly passed here so there is no possibility of trying to call back to the fs'sGFileSystem.getFSRL()
on a half-constructed filesystem.)payloadFilename
- name of the single file that this filesystem holds.length
- length of the payload file.payloadMD5
- md5 of the payload file.
-
-
Method Details
-
clear
public void clear()Clears the data held by this object. -
isPayloadFile
Returns true if the specified file is the payload file.- Parameters:
file
- GFile to test- Returns:
- boolean true if it is the payload file
-
isClosed
public boolean isClosed()Returns true if this object has beenclear()
'ed.- Returns:
- boolean true if data has been cleared.
-
getPayloadFile
Gets the 'payload' file, ie. the main file of this filesystem.- Returns:
GFile
payload file.
-
getRootDirFSRL
Gets the root dir's FSRL.- Returns:
FSRL
of the root dir.
-
getRootDir
Gets the rootGFile
object for this filesystem index.- Returns:
- root
GFile
object.
-
getFileCount
public int getFileCount()Number of files in this index.- Returns:
- number of file in this index.
-
getListing
Mirror'sGFileSystem.getListing(GFile)
interface.- Parameters:
directory
-GFile
directory to get the list of child files that have been added to this index, null means root directory.- Returns:
List
of GFile files that are in the specified directory, never null.- Throws:
IOException
- if already closed.
-
lookup
Mirror'sGFileSystem.lookup(String)
interface.- Parameters:
path
- path and filename of a file to find (either "/" for root or the payload file's path).- Returns:
GFile
instance or null if requested path is not the same as the payload file.
-
lookup
Mirror'sGFileSystem.lookup(String)
interface.- Parameters:
baseDir
- starting directorypath
- path and filename of a file to find (either "/" for root or the payload file's path).nameComp
- optionalComparator
that compares file names. Suggested values areString::compareTo
orString::compareToIgnoreCase
ornull
.- Returns:
GFile
instance or null if requested path is not the same as the payload file.
-
toString
-