Class AbstractSinglePayloadFileSystem

java.lang.Object
ghidra.formats.gfilesystem.AbstractSinglePayloadFileSystem
All Implemented Interfaces:
GFileSystem, ExtensionPoint, Closeable, AutoCloseable, Iterable<GFile>

public abstract class AbstractSinglePayloadFileSystem extends Object implements GFileSystem
Base class with common functionality for file systems that only contain a single file
  • Field Details

  • Constructor Details

  • Method Details

    • getPayloadFile

      public GFile getPayloadFile()
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getName

      public String getName()
      Description copied from interface: GFileSystem
      File system volume name.

      Typically the name of the container file, or a internally stored 'volume' name.

      Specified by:
      getName in interface GFileSystem
      Returns:
      string filesystem volume name.
    • getFSRL

      public FSRLRoot getFSRL()
      Description copied from interface: GFileSystem
      File system's FSRL
      Specified by:
      getFSRL in interface GFileSystem
      Returns:
      FSRLRoot of this filesystem.
    • isClosed

      public boolean isClosed()
      Description copied from interface: GFileSystem
      Returns true if the filesystem has been closed
      Specified by:
      isClosed in interface GFileSystem
      Returns:
      boolean true if the filesystem has been closed.
    • getRefManager

      public FileSystemRefManager getRefManager()
      Description copied from interface: GFileSystem
      Returns the ref manager that is responsible for creating and releasing refs to this filesystem.
      Specified by:
      getRefManager in interface GFileSystem
      Returns:
      FileSystemRefManager that manages references to this filesystem.
    • getFileCount

      public int getFileCount()
      Description copied from interface: GFileSystem
      Returns the number of files in the filesystem, if known, otherwise -1 if not known.
      Specified by:
      getFileCount in interface GFileSystem
      Returns:
      number of files in this filesystem, -1 if not known.
    • lookup

      public GFile lookup(String path) throws IOException
      Description copied from interface: GFileSystem
      Retrieves a GFile from this filesystem based on its full path and filename, using this filesystem's default name comparison logic (eg. case sensitive vs insensitive).
      Specified by:
      lookup in interface GFileSystem
      Parameters:
      path - string path and filename of a file located in this filesystem. Use null or "/" to retrieve the root directory
      Returns:
      GFile instance of requested file, null if not found.
      Throws:
      IOException - if IO error when looking up file.
    • lookup

      public GFile lookup(String path, Comparator<String> nameComp) throws IOException
      Description copied from interface: GFileSystem
      Retrieves a GFile from this filesystem based on its full path and filename, using the specified name comparison logic (eg. case sensitive vs insensitive).
      Specified by:
      lookup in interface GFileSystem
      Parameters:
      path - string path and filename of a file located in this filesystem. Use null or "/" to retrieve the root directory
      nameComp - string comparator used to compare filenames. Use null to specify the file system's native comparison logic.
      Returns:
      GFile instance of requested file, null if not found.
      Throws:
      IOException - if IO error when looking up file.
    • getByteProvider

      public ByteProvider getByteProvider(GFile file, TaskMonitor monitor) throws IOException, CancelledException
      Description copied from interface: GFileSystem
      Returns a ByteProvider that contains the contents of the specified GFile.

      The caller is responsible for closing the provider.

      Specified by:
      getByteProvider in interface GFileSystem
      Parameters:
      file - GFile to get bytes for
      monitor - TaskMonitor to watch and update progress
      Returns:
      new ByteProvider that contains the contents of the file, or NULL if file doesn't have data
      Throws:
      IOException - if error
      CancelledException - if user cancels
    • getListing

      public List<GFile> getListing(GFile directory) throws IOException
      Description copied from interface: GFileSystem
      Returns a list of files that reside in the specified directory on this filesystem.
      Specified by:
      getListing in interface GFileSystem
      Parameters:
      directory - NULL means root of filesystem.
      Returns:
      List of GFile instances of file in the requested directory.
      Throws:
      IOException - if IO problem.
    • getFileAttributes

      public FileAttributes getFileAttributes(GFile file, TaskMonitor monitor)
      Description copied from interface: GFileSystem
      Returns a container of FileAttribute values.

      Implementors of this method are not required to add FSRL, NAME, or PATH values unless the values are non-standard.

      Specified by:
      getFileAttributes in interface GFileSystem
      Parameters:
      file - GFile to get the attributes for
      monitor - TaskMonitor
      Returns:
      FileAttributes instance (possibly read-only), maybe empty but never null