Class AbstractFileSystem<METADATATYPE>

java.lang.Object
ghidra.formats.gfilesystem.AbstractFileSystem<METADATATYPE>
Type Parameters:
METADATATYPE - the type of objects that will be stored in the FileSystemIndexHelper
All Implemented Interfaces:
GFileSystem, ExtensionPoint, Closeable, AutoCloseable

public abstract class AbstractFileSystem<METADATATYPE> extends Object implements GFileSystem
Default implementation of base file system functionality.
  • Field Details

  • Constructor Details

    • AbstractFileSystem

      protected AbstractFileSystem(FSRLRoot fsFSRL, FileSystemService fsService)
      Initializes the fields for this abstract implementation of a file system.
      Parameters:
      fsFSRL - FSRLRoot of this file system
      fsService - reference to the FileSystemService instance
  • Method Details

    • 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.
    • 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.
    • getFilenameComparator

      protected Comparator<String> getFilenameComparator()
    • lookup

      public GFile lookup(String path)
      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.
    • getRootDir

      public GFile getRootDir()
      Description copied from interface: GFileSystem
      Returns the file system's root directory.

      Note: using null when calling GFileSystem.getListing(GFile) is also valid.

      Specified by:
      getRootDir in interface GFileSystem
      Returns:
      file system's root directory
    • getListing

      public List<GFile> getListing(GFile directory)
      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.
    • 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.
    • resolveSymlinks

      public GFile resolveSymlinks(GFile file) throws IOException
      Description copied from interface: GFileSystem
      Converts the specified (symlink) file into it's destination, or if not a symlink, returns the original file unchanged.
      Specified by:
      resolveSymlinks in interface GFileSystem
      Parameters:
      file - symlink file to follow
      Returns:
      destination of symlink, or original file if not a symlink
      Throws:
      IOException - if error following symlink path, typically outside of the hosting file system