Package ghidra.formats.gfilesystem
Class AbstractSinglePayloadFileSystem
java.lang.Object
ghidra.formats.gfilesystem.AbstractSinglePayloadFileSystem
- All Implemented Interfaces:
GFileSystem,ExtensionPoint,Closeable,AutoCloseable,Iterable<GFile>
Base class with common functionality for file systems that only contain a single file
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FSRLRootprotected final SingleFileSystemIndexHelperprotected ByteProviderprotected final FileSystemRefManager -
Constructor Summary
ConstructorsConstructorDescriptionAbstractSinglePayloadFileSystem(FSRLRoot fsFSRL, ByteProvider payloadProvider, String payloadFilename) AbstractSinglePayloadFileSystem(FSRLRoot fsFSRL, ByteProvider payloadProvider, String payloadFilename, FileAttributes payloadAttrs) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getByteProvider(GFile file, TaskMonitor monitor) Returns aByteProviderthat contains the contents of the specifiedGFile.getFileAttributes(GFile file, TaskMonitor monitor) Returns a container ofFileAttributevalues.intReturns the number of files in the filesystem, if known, otherwise -1 if not known.getFSRL()File system's FSRLgetListing(GFile directory) Returns a list offilesthat reside in the specified directory on this filesystem.getName()File system volume name.Returns theref managerthat is responsible for creating and releasingrefsto this filesystem.booleanisClosed()Returns true if the filesystem has beenclosedRetrieves aGFilefrom this filesystem based on its full path and filename, using this filesystem's default name comparison logic (eg.lookup(String path, Comparator<String> nameComp) Retrieves aGFilefrom this filesystem based on its full path and filename, using the specified name comparison logic (eg.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.formats.gfilesystem.GFileSystem
files, files, files, files, getDescription, getFileType, getInputStream, getRootDir, getType, isStatic, iterator, resolveSymlinksMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
fsFSRL
-
refManager
-
fsIndex
-
payloadProvider
-
-
Constructor Details
-
AbstractSinglePayloadFileSystem
public AbstractSinglePayloadFileSystem(FSRLRoot fsFSRL, ByteProvider payloadProvider, String payloadFilename) -
AbstractSinglePayloadFileSystem
public AbstractSinglePayloadFileSystem(FSRLRoot fsFSRL, ByteProvider payloadProvider, String payloadFilename, FileAttributes payloadAttrs)
-
-
Method Details
-
getPayloadFile
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getName
Description copied from interface:GFileSystemFile system volume name.Typically the name of the container file, or a internally stored 'volume' name.
- Specified by:
getNamein interfaceGFileSystem- Returns:
- string filesystem volume name.
-
getFSRL
Description copied from interface:GFileSystemFile system's FSRL- Specified by:
getFSRLin interfaceGFileSystem- Returns:
FSRLRootof this filesystem.
-
isClosed
public boolean isClosed()Description copied from interface:GFileSystemReturns true if the filesystem has beenclosed- Specified by:
isClosedin interfaceGFileSystem- Returns:
- boolean true if the filesystem has been closed.
-
getRefManager
Description copied from interface:GFileSystemReturns theref managerthat is responsible for creating and releasingrefsto this filesystem.- Specified by:
getRefManagerin interfaceGFileSystem- Returns:
FileSystemRefManagerthat manages references to this filesystem.
-
getFileCount
public int getFileCount()Description copied from interface:GFileSystemReturns the number of files in the filesystem, if known, otherwise -1 if not known.- Specified by:
getFileCountin interfaceGFileSystem- Returns:
- number of files in this filesystem, -1 if not known.
-
lookup
Description copied from interface:GFileSystemRetrieves aGFilefrom this filesystem based on its full path and filename, using this filesystem's default name comparison logic (eg. case sensitive vs insensitive).- Specified by:
lookupin interfaceGFileSystem- Parameters:
path- string path and filename of a file located in this filesystem. Usenullor "/" to retrieve the root directory- Returns:
GFileinstance of requested file, null if not found.- Throws:
IOException- if IO error when looking up file.
-
lookup
Description copied from interface:GFileSystemRetrieves aGFilefrom this filesystem based on its full path and filename, using the specified name comparison logic (eg. case sensitive vs insensitive).- Specified by:
lookupin interfaceGFileSystem- Parameters:
path- string path and filename of a file located in this filesystem. Usenullor "/" to retrieve the root directorynameComp- string comparator used to compare filenames. Usenullto specify the file system's native comparison logic.- Returns:
GFileinstance of requested file, null if not found.- Throws:
IOException- if IO error when looking up file.
-
getByteProvider
public ByteProvider getByteProvider(GFile file, TaskMonitor monitor) throws IOException, CancelledException Description copied from interface:GFileSystemReturns aByteProviderthat contains the contents of the specifiedGFile.The caller is responsible for closing the provider.
- Specified by:
getByteProviderin interfaceGFileSystem- Parameters:
file-GFileto get bytes formonitor-TaskMonitorto watch and update progress- Returns:
- new
ByteProviderthat contains the contents of the file, or NULL if file doesn't have data - Throws:
IOException- if errorCancelledException- if user cancels
-
getListing
Description copied from interface:GFileSystemReturns a list offilesthat reside in the specified directory on this filesystem.- Specified by:
getListingin interfaceGFileSystem- Parameters:
directory- NULL means root of filesystem.- Returns:
ListofGFileinstances of file in the requested directory.- Throws:
IOException- if IO problem.
-
getFileAttributes
Description copied from interface:GFileSystemReturns a container ofFileAttributevalues.Implementors of this method are not required to add FSRL, NAME, or PATH values unless the values are non-standard.
- Specified by:
getFileAttributesin interfaceGFileSystem- Parameters:
file-GFileto get the attributes formonitor-TaskMonitor- Returns:
FileAttributesinstance (possibly read-only), maybe empty but never null
-