Class GFileSystemBaseFactory
- java.lang.Object
-
- ghidra.formats.gfilesystem.factory.GFileSystemBaseFactory
-
- All Implemented Interfaces:
GFileSystemFactory<GFileSystemBase>
,GFileSystemFactoryFull<GFileSystemBase>
,GFileSystemProbe
,GFileSystemProbeFull
public class GFileSystemBaseFactory extends java.lang.Object implements GFileSystemFactoryFull<GFileSystemBase>, GFileSystemProbeFull
AGFileSystemFactory
implementation that probes and creates instances ofGFileSystemBase
which use the legacy filesystem lifecycle pattern.For each operation, this factory will mint a new instance of a GFileSystemBase-derived fs, using its 3 param constructor, and call its isValid() or open().
After an isValid() call, the newly minted filesystem instance is thrown away.
This class requires special support in the
FileSystemFactoryMgr
to push the fsClass into each factory instance after it is constructed.
-
-
Constructor Summary
Constructors Constructor Description GFileSystemBaseFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GFileSystemBase
create(FSRL containerFSRL, FSRLRoot targetFSRL, ByteProvider byteProvider, java.io.File containerFile, FileSystemService fsService, TaskMonitor monitor)
Constructs a newGFileSystem
instance that handles the specified file.boolean
probe(FSRL containerFSRL, ByteProvider byteProvider, java.io.File containerFile, FileSystemService fsService, TaskMonitor monitor)
Probes the specifiedcontainerFile
to determine if this filesystem implementation can handle the file.void
setFileSystemClass(java.lang.Class<? extends GFileSystemBase> fsClass)
-
-
-
Method Detail
-
setFileSystemClass
public void setFileSystemClass(java.lang.Class<? extends GFileSystemBase> fsClass)
-
probe
public boolean probe(FSRL containerFSRL, ByteProvider byteProvider, java.io.File containerFile, FileSystemService fsService, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from interface:GFileSystemProbeFull
Probes the specifiedcontainerFile
to determine if this filesystem implementation can handle the file.- Specified by:
probe
in interfaceGFileSystemProbeFull
- Parameters:
containerFSRL
- theFSRL
of the file being probedbyteProvider
- aByteProvider
containing the contents of the file being probed. Implementors of this method should NOTclose()
this object.containerFile
- theFile
(probably in the filecache with non-useful filename) being probed.fsService
- a reference to theFileSystemService
objectmonitor
- aTaskMonitor
that should be polled to see if the user has requested to cancel the operation, and updated with progress information.- Returns:
true
if the specified file is handled by this filesystem implementation,false
if not.- Throws:
java.io.IOException
- if there is an error reading files.CancelledException
- if the user cancels
-
create
public GFileSystemBase create(FSRL containerFSRL, FSRLRoot targetFSRL, ByteProvider byteProvider, java.io.File containerFile, FileSystemService fsService, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from interface:GFileSystemFactoryFull
Constructs a newGFileSystem
instance that handles the specified file.- Specified by:
create
in interfaceGFileSystemFactoryFull<GFileSystemBase>
- Parameters:
containerFSRL
- theFSRL
of the file being opened.targetFSRL
- theFSRLRoot
of the filesystem being created.byteProvider
- aByteProvider
containing the contents of the file being probed. This method is responsible for closing this byte provider instance.containerFile
- theFile
(probably in the filecache with non-useful filename) being opened.fsService
- a reference to theFileSystemService
objectmonitor
- aTaskMonitor
that should be polled to see if the user has requested to cancel the operation, and updated with progress information.- Returns:
- a new
GFileSystem
derived instance. - Throws:
java.io.IOException
- if there is an error reading files.CancelledException
- if the user cancels
-
-