Class FileSystemFactoryMgr
java.lang.Object
ghidra.formats.gfilesystem.factory.FileSystemFactoryMgr
Statically scoped mugger that handles the dirty work of probing for and creating
 
GFileSystem instances.
 
 Auto-discovers all GFileSystem instances in the classpath that have a
 FileSystemInfo annotation.
- 
Method Summary
Modifier and TypeMethodDescriptionReturns a list of all registered filesystem implementation descriptions.getFileSystemType(Class<? extends GFileSystem> fsClass) Returns the file system type of the specifiedGFileSystemclass.static FileSystemFactoryMgrReturns The single globalFileSystemFactoryMgrinstance..mountFileSystem(String fsType, ByteProvider byteProvider, FileSystemService fsService, TaskMonitor monitor) Creates a newGFileSysteminstance when the filesystem type is already known, consuming the specified ByteProvider.probe(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.probe(ByteProvider byteProvider, FileSystemService fsService, FileSystemProbeConflictResolver conflictResolver, TaskMonitor monitor) Probes the specified file for a supportedGFileSystemimplementation, and if found, creates a new filesystem instance.booleantest(ByteProvider byteProvider, FileSystemService fsService, TaskMonitor monitor) Returns true if the specified file contains a supportedGFileSystem. 
- 
Method Details
- 
getInstance
Returns The single globalFileSystemFactoryMgrinstance..- Returns:
 - The single global 
FileSystemFactoryMgrinstance. 
 - 
getAllFilesystemNames
Returns a list of all registered filesystem implementation descriptions.- Returns:
 - list of strings
 
 - 
getFileSystemType
Returns the file system type of the specifiedGFileSystemclass.- Parameters:
 fsClass- Class to inspect- Returns:
 - String file system type, from the 
FileSystemInfo.type()annotation. 
 - 
mountFileSystem
public GFileSystem mountFileSystem(String fsType, ByteProvider byteProvider, FileSystemService fsService, TaskMonitor monitor) throws 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:
 IOException- if error when opening the filesystem or unknown fsType.CancelledException- if the user canceled the operation.
 - 
test
public boolean test(ByteProvider byteProvider, FileSystemService fsService, TaskMonitor monitor) throws 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:
 IOException- if error when accessing the containing fileCancelledException- if the user canceled the operation
 - 
probe
public GFileSystem probe(ByteProvider byteProvider, FileSystemService fsService, FileSystemProbeConflictResolver conflictResolver, TaskMonitor monitor) throws IOException, CancelledException Probes the specified file for a supportedGFileSystemimplementation, and if found, creates a new filesystem instance.- 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.monitor-TaskMonitorto use for canceling and updating progress.- Returns:
 - new 
GFileSysteminstance or null not supported. - Throws:
 IOException- if error accessing the containing fileCancelledException- if the user cancels the operation
 - 
probe
public GFileSystem probe(ByteProvider byteProvider, FileSystemService fsService, FileSystemProbeConflictResolver conflictResolver, int priorityFilter, TaskMonitor monitor) throws 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:
 IOException- if error accessing the containing fileCancelledException- if the user cancels the operation
 
 -