Package ghidra.formats.gfilesystem
Class AbstractFileSystem<METADATATYPE>
java.lang.Object
ghidra.formats.gfilesystem.AbstractFileSystem<METADATATYPE>
- Type Parameters:
METADATATYPE
- the type of objects that will be stored in the FileSystemIndexHelper
- All Implemented Interfaces:
GFileSystem
,ExtensionPoint
,Closeable
,AutoCloseable
Default implementation of base file system functionality.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final FSRLRoot
protected FileSystemIndexHelper
<METADATATYPE> protected final FileSystemService
protected FileSystemRefManager
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractFileSystem
(FSRLRoot fsFSRL, FileSystemService fsService) Initializes the fields for this abstract implementation of a file system. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the number of files in the filesystem, if known, otherwise -1 if not known.protected Comparator
<String> getFSRL()
File system's FSRLgetListing
(GFile directory) Returns a list offiles
that reside in the specified directory on this filesystem.getName()
File system volume name.Returns theref manager
that is responsible for creating and releasingrefs
to this filesystem.Returns the file system's root directory.Retrieves aGFile
from this filesystem based on its full path and filename, using this filesystem's default name comparison logic (eg.resolveSymlinks
(GFile file) Converts the specified (symlink) file into it's destination, or if not a symlink, returns the original file unchanged.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ghidra.formats.gfilesystem.GFileSystem
getByteProvider, getDescription, getFileAttributes, getInputStream, getType, isClosed, isStatic
-
Field Details
-
fsService
-
fsFSRL
-
fsIndex
-
refManager
-
-
Constructor Details
-
AbstractFileSystem
Initializes the fields for this abstract implementation of a file system.- Parameters:
fsFSRL
-FSRLRoot
of this file systemfsService
- reference to theFileSystemService
instance
-
-
Method Details
-
getName
Description copied from interface:GFileSystem
File system volume name.Typically the name of the container file, or a internally stored 'volume' name.
- Specified by:
getName
in interfaceGFileSystem
- Returns:
- string filesystem volume name.
-
getFSRL
Description copied from interface:GFileSystem
File system's FSRL- Specified by:
getFSRL
in interfaceGFileSystem
- Returns:
FSRLRoot
of this filesystem.
-
getRefManager
Description copied from interface:GFileSystem
Returns theref manager
that is responsible for creating and releasingrefs
to this filesystem.- Specified by:
getRefManager
in interfaceGFileSystem
- Returns:
FileSystemRefManager
that manages references to this filesystem.
-
getFilenameComparator
-
lookup
Description copied from interface:GFileSystem
Retrieves aGFile
from this filesystem based on its full path and filename, using this filesystem's default name comparison logic (eg. case sensitive vs insensitive).- Specified by:
lookup
in interfaceGFileSystem
- Parameters:
path
- string path and filename of a file located in this filesystem. Usenull
or "/" to retrieve the root directory- Returns:
GFile
instance of requested file, null if not found.
-
getRootDir
Description copied from interface:GFileSystem
Returns the file system's root directory.Note: using
null
when callingGFileSystem.getListing(GFile)
is also valid.- Specified by:
getRootDir
in interfaceGFileSystem
- Returns:
- file system's root directory
-
getListing
Description copied from interface:GFileSystem
Returns a list offiles
that reside in the specified directory on this filesystem.- Specified by:
getListing
in interfaceGFileSystem
- Parameters:
directory
- NULL means root of filesystem.- Returns:
List
ofGFile
instances of file in the requested directory.
-
getFileCount
public int getFileCount()Description copied from interface:GFileSystem
Returns the number of files in the filesystem, if known, otherwise -1 if not known.- Specified by:
getFileCount
in interfaceGFileSystem
- Returns:
- number of files in this filesystem, -1 if not known.
-
resolveSymlinks
Description copied from interface:GFileSystem
Converts the specified (symlink) file into it's destination, or if not a symlink, returns the original file unchanged.- Specified by:
resolveSymlinks
in interfaceGFileSystem
- Parameters:
file
- symlink file to follow- Returns:
- destination of symlink, or original file if not a symlink
- Throws:
IOException
- if error following symlink path, typically outside of the hosting file system
-