Package ghidra.formats.gfilesystem
Class SingleFileSystemIndexHelper
- java.lang.Object
-
- ghidra.formats.gfilesystem.SingleFileSystemIndexHelper
-
public class SingleFileSystemIndexHelper extends java.lang.ObjectA 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
Constructors Constructor Description SingleFileSystemIndexHelper(GFileSystem fs, FSRLRoot fsFSRL, java.lang.String payloadFilename, long length, java.lang.String payloadMD5)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the data held by this object.intgetFileCount()Number of files in this index.java.util.List<GFile>getListing(GFile directory)Mirror'sGFileSystem.getListing(GFile)interface.GFilegetPayloadFile()Gets the 'payload' file, ie.GFilegetRootDir()Gets the rootGFileobject for this filesystem index.FSRLgetRootDirFSRL()Gets the root dir's FSRL.booleanisClosed()Returns true if this object has beenclear()'ed.booleanisPayloadFile(GFile file)Returns true if the specified file is the payload file.GFilelookup(java.lang.String path)Mirror'sGFileSystem.lookup(String)interface.java.lang.StringtoString()
-
-
-
Constructor Detail
-
SingleFileSystemIndexHelper
public SingleFileSystemIndexHelper(GFileSystem fs, FSRLRoot fsFSRL, java.lang.String payloadFilename, long length, java.lang.String payloadMD5)
Creates a new instance. A "root" directory GFile will be auto-created for the filesystem.- Parameters:
fs- theGFileSystemthat this index will be for.fsFSRL- thefsrlof 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 Detail
-
clear
public void clear()
Clears the data held by this object.
-
isPayloadFile
public boolean isPayloadFile(GFile file)
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
public GFile getPayloadFile()
Gets the 'payload' file, ie. the main file of this filesystem.- Returns:
GFilepayload file.
-
getRootDirFSRL
public FSRL getRootDirFSRL()
Gets the root dir's FSRL.- Returns:
FSRLof the root dir.
-
getRootDir
public GFile getRootDir()
Gets the rootGFileobject for this filesystem index.- Returns:
- root
GFileobject.
-
getFileCount
public int getFileCount()
Number of files in this index.- Returns:
- number of file in this index.
-
getListing
public java.util.List<GFile> getListing(GFile directory) throws java.io.IOException
Mirror'sGFileSystem.getListing(GFile)interface.- Parameters:
directory-GFiledirectory to get the list of child files that have been added to this index, null means root directory.- Returns:
Listof GFile files that are in the specified directory, never null.- Throws:
java.io.IOException- if already closed.
-
lookup
public GFile lookup(java.lang.String path)
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:
GFileinstance or null if requested path is not the same as the payload file.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-