Class FileSystemFactoryMgr
- java.lang.Object
-
- ghidra.formats.gfilesystem.factory.FileSystemFactoryMgr
-
public class FileSystemFactoryMgr extends java.lang.ObjectStatically scoped mugger that handles the dirty work of probing for and creatingGFileSysteminstances.Auto-discovers all
GFileSysteminstances in the classpath that have aFileSystemInfoannotation.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Change Modifier and Type Method Description java.util.List<java.lang.String>getAllFilesystemNames()Returns a list of all registered filesystem implementation descriptions.java.lang.StringgetFileSystemType(java.lang.Class<? extends GFileSystem> fsClass)Returns the file system type of the specifiedGFileSystemclass.static FileSystemFactoryMgrgetInstance()NEW GFileSystemmountFileSystem(java.lang.String fsType, ByteProvider byteProvider, FileSystemService fsService, TaskMonitor monitor)Creates a newGFileSysteminstance when the filesystem type is already known, consuming the specified ByteProvider.NEW GFileSystemprobe(ByteProvider byteProvider, FileSystemService fsService, FileSystemProbeConflictResolver conflictResolver, int priorityFilter, TaskMonitor monitor)Probes the specified file for a supportedGFileSystemimplementation, and if found, creates a new filesystem instance.NEW GFileSystemprobe(ByteProvider byteProvider, FileSystemService fsService, FileSystemProbeConflictResolver conflictResolver, TaskMonitor monitor)Probes the specified file for a supportedGFileSystemimplementation, and if found, creates a new filesystem instance.NEW booleantest(ByteProvider byteProvider, FileSystemService fsService, TaskMonitor monitor)Returns true if the specified file contains a supportedGFileSystem.REMOVED GFileSystemmountFileSystem(String fsType, FSRL containerFSRL, File containerFile, FileSystemService fsService, TaskMonitor monitor) (Removed)REMOVED booleantest(FSRL containerFSRL, File containerFile, FileSystemService fsService, TaskMonitor monitor) (Removed)REMOVED GFileSystemprobe(FSRL containerFSRL, File containerFile, FileSystemService fsService, FileSystemProbeConflictResolver conflictResolver, TaskMonitor monitor) (Removed)REMOVED GFileSystemprobe(FSRL containerFSRL, File containerFile, FileSystemService fsService, FileSystemProbeConflictResolver conflictResolver, int priorityFilter, TaskMonitor monitor) (Removed)
-
-
-
Method Detail
-
getInstance
public static FileSystemFactoryMgr getInstance()
- Returns:
- The single global
FileSystemFactoryMgrinstance.
-
getAllFilesystemNames
public java.util.List<java.lang.String> getAllFilesystemNames()
Returns a list of all registered filesystem implementation descriptions.- Returns:
- list of strings
-
getFileSystemType
public java.lang.String getFileSystemType(java.lang.Class<? extends GFileSystem> fsClass)
Returns the file system type of the specifiedGFileSystemclass.- Parameters:
fsClass- Class to inspect- Returns:
- String file system type, from the
FileSystemInfo.type()annotation.
-
mountFileSystem NEW
public GFileSystem mountFileSystem(java.lang.String fsType, ByteProvider byteProvider, FileSystemService fsService, TaskMonitor monitor) throws java.io.IOException, CancelledException
Creates a newGFileSysteminstance when the filesystem type is already known, consuming the specified ByteProvider.- Parameters:
fsType- filesystem type string, ie. "file", "zip".byteProvider-ByteProvider, will be owned by the new file systemfsService- reference to theFileSystemServiceinstance.monitor-TaskMonitorto use for canceling and updating progress.- Returns:
- new
GFileSysteminstance. - Throws:
java.io.IOException- if error when opening the filesystem or unknown fsType.CancelledException- if the user canceled the operation.
-
test NEW
public boolean test(ByteProvider byteProvider, FileSystemService fsService, TaskMonitor monitor) throws java.io.IOException, CancelledException
Returns true if the specified file contains a supportedGFileSystem.- Parameters:
byteProvider-fsService- reference to theFileSystemServiceinstance.monitor-TaskMonitorto use for canceling and updating progress.- Returns:
trueif the file seems to contain a filesystem,falseif it does not.- Throws:
java.io.IOException- if error when accessing the containing fileCancelledException- if the user canceled the operation
-
probe NEW
public GFileSystem probe(ByteProvider byteProvider, FileSystemService fsService, FileSystemProbeConflictResolver conflictResolver, TaskMonitor monitor) throws java.io.IOException, CancelledException
Probes the specified file for a supportedGFileSystemimplementation, and if found, creates a new filesystem instance.- Parameters:
containerFSRL-FSRLof the containing file.containerFile-Filethe containing file.fsService- reference to theFileSystemServiceinstance.conflictResolver-conflict resolverto use when more than oneGFileSystemimplementation can handle the specified file.monitor-TaskMonitorto use for canceling and updating progress.- Returns:
- new
GFileSysteminstance or null not supported. - Throws:
java.io.IOException- if error accessing the containing fileCancelledException- if the user cancels the operation
-
probe NEW
public GFileSystem probe(ByteProvider byteProvider, FileSystemService fsService, FileSystemProbeConflictResolver conflictResolver, int priorityFilter, TaskMonitor monitor) throws java.io.IOException, CancelledException
Probes the specified file for a supportedGFileSystemimplementation, and if found, creates a new filesystem instance. The ByteProvider is owned by the new file system.- Parameters:
byteProvider- containerByteProvider, will be owned by the new filesystemfsService- reference to theFileSystemServiceinstance.conflictResolver-conflict resolverto use when more than oneGFileSystemimplementation can handle the specified file.priorityFilter- limits the probe to filesystems that have aFileSystemInfo.priority()greater than or equal to this value. UseFileSystemInfo.PRIORITY_LOWESTto include all filesystem implementations.monitor-TaskMonitorto use for canceling and updating progress.- Returns:
- new
GFileSysteminstance or null not supported. - Throws:
java.io.IOException- if error accessing the containing fileCancelledException- if the user cancels the operation
-
-