Package ghidra.formats.gfilesystem.factory

# Class GFileSystemBaseFactory

java.lang.Object
ghidra.formats.gfilesystem.factory.GFileSystemBaseFactory

All Implemented Interfaces:
  `GFileSystemFactory<GFileSystemBase>`, `GFileSystemFactoryByteProvider<GFileSystemBase>`, `GFileSystemProbe`, `GFileSystemProbeByteProvider`

public class GFileSystemBaseFactory extends Object implements GFileSystemFactoryByteProvider<GFileSystemBase>, GFileSystemProbeByteProvider
A `GFileSystemFactory` implementation that probes and creates instances of `GFileSystemBase` 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

  Modifier and Type
  Method
  Description
  `GFileSystemBase`
  `create(FSRLRoot targetFSRL, ByteProvider byteProvider, FileSystemService fsService, TaskMonitor monitor)`
  Constructs a new `GFileSystem` instance that handles the specified file.
  `boolean`
  `probe(ByteProvider byteProvider, FileSystemService fsService, TaskMonitor monitor)`
  Probes the specified `ByteProvider` to determine if this filesystem implementation can handle the file.
  `void`
  `setFileSystemClass(Class<? extends GFileSystemBase> fsClass)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### GFileSystemBaseFactory

    public GFileSystemBaseFactory()

- ## Method Details

  - ### setFileSystemClass

    public void setFileSystemClass(Class<? extends GFileSystemBase> fsClass)

  - ### probe

    public boolean probe(ByteProvider byteProvider, FileSystemService fsService, TaskMonitor monitor) throws IOException, CancelledException
    Description copied from interface: `GFileSystemProbeByteProvider`
    Probes the specified `ByteProvider` to determine if this filesystem implementation can handle the file.
    Specified by:
      `probe` in interface `GFileSystemProbeByteProvider`
    Parameters:
      `byteProvider` - a `ByteProvider` containing the contents of the file being probed. Implementors of this method should NOT `close()` this object.
      `fsService` - a reference to the `FileSystemService` object
      `monitor` - a `TaskMonitor` 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:
      `IOException` - if there is an error reading files.
      `CancelledException` - if the user cancels

  - ### create

    public GFileSystemBase create(FSRLRoot targetFSRL, ByteProvider byteProvider, FileSystemService fsService, TaskMonitor monitor) throws IOException, CancelledException
    Description copied from interface: `GFileSystemFactoryByteProvider`
    Constructs a new `GFileSystem` instance that handles the specified file.

    Specified by:
      `create` in interface `GFileSystemFactoryByteProvider<GFileSystemBase>`
    Parameters:
      `targetFSRL` - the `FSRLRoot` of the filesystem being created.
      `byteProvider` - a `ByteProvider` containing the contents of the file being probed. This method is responsible for closing this byte provider instance.
      `fsService` - a reference to the `FileSystemService` object
      `monitor` - a `TaskMonitor` 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:
      `IOException` - if there is an error reading files.
      `CancelledException` - if the user cancels