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,Iterable<GFile>
Default implementation of base file system functionality.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FSRLRootprotected FileSystemIndexHelper<METADATATYPE> protected final FileSystemServiceprotected FileSystemRefManager -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFileSystem(FSRLRoot fsFSRL, FileSystemService fsService) Initializes the fields for this abstract implementation of a file system. -
Method Summary
Modifier and TypeMethodDescriptionintReturns 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 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.Returns the file system's root directory.Retrieves 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.resolveSymlinks(GFile file) Converts the specified (symlink) file into it's destination, or if not a symlink, returns the original file unchanged.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ghidra.formats.gfilesystem.GFileSystem
files, files, files, files, getByteProvider, getDescription, getFileAttributes, getInputStream, getType, isClosed, isStatic, iteratorMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
fsService
-
fsFSRL
-
fsIndex
-
refManager
-
-
Constructor Details
-
AbstractFileSystem
Initializes the fields for this abstract implementation of a file system.- Parameters:
fsFSRL-FSRLRootof this file systemfsService- reference to theFileSystemServiceinstance
-
-
Method Details
-
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.
-
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.
-
getFilenameComparator
-
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.
-
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.
-
getRootDir
Description copied from interface:GFileSystemReturns the file system's root directory.Note: using
nullwhen callingGFileSystem.getListing(GFile)is also valid.- Specified by:
getRootDirin interfaceGFileSystem- Returns:
- file system's root directory
-
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.
-
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.
-
resolveSymlinks
Description copied from interface:GFileSystemConverts the specified (symlink) file into it's destination, or if not a symlink, returns the original file unchanged.- Specified by:
resolveSymlinksin 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
-
toString
-