Package ghidra.framework.store.local

# Class IndexedLocalFileSystem

java.lang.Object
ghidra.framework.store.local.LocalFileSystem
ghidra.framework.store.local.IndexedLocalFileSystem

All Implemented Interfaces:
  `FileSystem`

Direct Known Subclasses:
  `IndexedV1LocalFileSystem`

public class IndexedLocalFileSystem extends LocalFileSystem
`IndexedLocalFileSystem` implements a case-sensitive indexed filesystem which uses a shallow storage hierarchy with no restriction on file name or path length. This filesystem is identified by the existence of an index file (~index.dat) and recovery journal (~index.jrn).

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `IndexedLocalFileSystem.BadStorageNameException`
  `BadStorageNameException` invalid storage name encountered.
  `static class`
  `IndexedLocalFileSystem.IndexReadException`
  `IndexReadException` occurs when an error occurs while reading/processing the filesystem index
  `static class`
  `IndexedLocalFileSystem.IndexVersionException`
  `IndexReadException` occurs when an error occurs while reading/processing the filesystem index

  ## Nested classes/interfaces inherited from class ghidra.framework.store.local.LocalFileSystem

  `LocalFileSystem.ItemStorage`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final String`
  `INDEX_ITEM_INDENT`
  `protected static final String`
  `INDEX_ITEM_SEPARATOR`
  `static final int`
  `LATEST_INDEX_VERSION`

  ### Fields inherited from class ghidra.framework.store.local.LocalFileSystem

  `eventManager, HIDDEN_DIR_PREFIX, HIDDEN_DIR_PREFIX_CHAR, HIDDEN_ITEM_PREFIX, isVersioned, readOnly, root`

  ### Fields inherited from interface ghidra.framework.store.FileSystem

  `SEPARATOR, SEPARATOR_CHAR`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `IndexedLocalFileSystem(String rootPath)`
  Construct existing indexed filesystem with an empty index.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected LocalFileSystem.ItemStorage`
  `allocateItemStorage(String folderPath, String itemName)`
  Allocate a new storage location
  `void`
  `createFolder(String parentPath, String folderName)`
  Creates a new subfolder within the specified parent folder.
  `protected void`
  `deallocateItemStorage(String folderPath, String itemName)`
  Deallocate item storage
  `void`
  `deleteFolder(String folderPath)`
  Delete the specified folder.
  `void`
  `dispose()`
  Cleanup and release resources
  `protected LocalFileSystem.ItemStorage`
  `findItemStorage(String folderPath, String itemName)`
  Find an existing storage location
  `boolean`
  `folderExists(String folderPath)`
  Returns true if the folder specified by the path exists.
  `String[]`
  `getFolderNames(String folderPath)`
  Return a list of subfolders (by name) that are stored within the specified folder path.
  `int`
  `getIndexImplementationVersion()`
  `int`
  `getItemCount()`
  Returns the number of folder items contained within this file-system.
  `protected String[]`
  `getItemNames(String folderPath, boolean includeHiddenFiles)`
  `int`
  `getMaxNameLength()`
  `static boolean`
  `hasIndexedStructure(String rootPath)`
  Determine if the specified directory contains a likely indexed filesystem.
  `static boolean`
  `isIndexed(String rootPath)`
  Determine if the specified directory corresponds to an indexed filesystem.
  `protected void`
  `itemDeleted(String folderPath, String itemName)`
  Notify the filesystem that the property file and associated data files for an item have been removed from the filesystem.
  `void`
  `moveFolder(String parentPath, String folderName, String newParentPath)`
  Move the specified folder to the path specified by newFolderPath.
  `void`
  `moveItem(String folderPath, String name, String newFolderPath, String newName)`
  Moves the specified item to a new folder.
  `static int`
  `readIndexVersion(String rootPath)`
  `static boolean`
  `rebuild(File rootDir)`
  Completely rebuild filesystem index using item information contained within indexed property files.
  `void`
  `renameFolder(String parentPath, String folderName, String newFolderName)`
  Renames the specified folder to a new name.

  ### Methods inherited from class ghidra.framework.store.local.LocalFileSystem

  `addFileSystemListener, checkDisposed, cleanupAfterConstruction, createDatabase, createDatabase, createDataFile, createFile, createTemporaryDatabase, deleteEmptyVersionedFolders, escapeHiddenDirPrefixChars, fileExists, fileIdChanged, getItem, getItem, getItemNames, getLocalFileSystem, getName, getParentPath, getPath, getUserName, isHiddenDirName, isOnline, isReadOnly, isRefreshRequired, isShared, isValidNameCharacter, isVersioned, log, migrationInProgress, removeFileSystemListener, setAssociatedRepositoryLogger, setValidationRequired, testValidName, unescapeHiddenDirPrefixChars`

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

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

- ## Field Details

  - ### LATEST_INDEX_VERSION

    public static final int LATEST_INDEX_VERSION
    See Also:
      - Constant Field Values

  - ### INDEX_ITEM_INDENT

    protected static final String INDEX_ITEM_INDENT
    See Also:
      - Constant Field Values

  - ### INDEX_ITEM_SEPARATOR

    protected static final String INDEX_ITEM_SEPARATOR
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### IndexedLocalFileSystem

    protected IndexedLocalFileSystem(String rootPath) throws IOException
    Construct existing indexed filesystem with an empty index. This can be used to prepare for rebuilding the filesystem index.
    Parameters:
      `rootPath` -
    Throws:
      `IOException`

- ## Method Details

  - ### getMaxNameLength

    public int getMaxNameLength()
    Specified by:
      `getMaxNameLength` in class `LocalFileSystem`
    Returns:
      the maximum name length permitted for folders or items.

  - ### dispose

    public void dispose()
    Description copied from interface: `FileSystem`
    Cleanup and release resources
    Specified by:
      `dispose` in interface `FileSystem`
    Overrides:
      `dispose` in class `LocalFileSystem`

  - ### getIndexImplementationVersion

    public int getIndexImplementationVersion()

  - ### readIndexVersion

    public static int readIndexVersion(String rootPath) throws IOException
    Throws:
      `IOException`

  - ### findItemStorage

    protected LocalFileSystem.ItemStorage findItemStorage(String folderPath, String itemName) throws FileNotFoundException
    Find an existing storage location
    Specified by:
      `findItemStorage` in class `LocalFileSystem`
    Parameters:
      `folderPath` -
      `itemName` -
    Returns:
      storage location. A non-null value does not guarantee that the associated item actually exists.
    Throws:
      `FileNotFoundException`

  - ### allocateItemStorage

    protected LocalFileSystem.ItemStorage allocateItemStorage(String folderPath, String itemName) throws IOException, InvalidNameException
    Allocate a new storage location
    Specified by:
      `allocateItemStorage` in class `LocalFileSystem`
    Parameters:
      `folderPath` -
      `itemName` -
    Returns:
      storage location
    Throws:
      `DuplicateFileException` - if item path has previously been allocated
      `IOException` - if invalid path/item name specified
      `InvalidNameException` - if folderPath or itemName contains invalid characters

  - ### deallocateItemStorage

    protected void deallocateItemStorage(String folderPath, String itemName) throws IOException
    Deallocate item storage
    Specified by:
      `deallocateItemStorage` in class `LocalFileSystem`
    Parameters:
      `folderPath` -
      `itemName` -
    Throws:
      `IOException`

  - ### itemDeleted

    protected void itemDeleted(String folderPath, String itemName) throws IOException
    Description copied from class: `LocalFileSystem`
    Notify the filesystem that the property file and associated data files for an item have been removed from the filesystem.
    Overrides:
      `itemDeleted` in class `LocalFileSystem`
    Throws:
      `IOException`

  - ### getItemNames

    protected String[] getItemNames(String folderPath, boolean includeHiddenFiles) throws IOException
    Specified by:
      `getItemNames` in class `LocalFileSystem`
    Throws:
      `IOException`

  - ### getItemCount

    public int getItemCount() throws IOException
    Description copied from interface: `FileSystem`
    Returns the number of folder items contained within this file-system.
    Throws:
      `IOException`

  - ### getFolderNames

    public String[] getFolderNames(String folderPath) throws IOException
    Description copied from interface: `FileSystem`
    Return a list of subfolders (by name) that are stored within the specified folder path.
    Throws:
      `FileNotFoundException` - if folder path does not exist.
      `IOException` - if IO error occurs.

  - ### createFolder

    public void createFolder(String parentPath, String folderName) throws InvalidNameException, IOException
    Description copied from interface: `FileSystem`
    Creates a new subfolder within the specified parent folder.
    Parameters:
      `parentPath` - folder path of parent
      `folderName` - name of new subfolder
    Throws:
      `InvalidNameException` - if the name does not have all alphanumerics
      `DuplicateFileException` - if a folder exists with this name
      `IOException` - thrown if an IO error occurs.

  - ### deleteFolder

    public void deleteFolder(String folderPath) throws IOException
    Description copied from interface: `FileSystem`
    Delete the specified folder.
    Parameters:
      `folderPath` - path of folder to be deleted
    Throws:
      `FolderNotEmptyException` - Thrown if the folder is not empty.
      `FileNotFoundException` - if there is no folder with the given path name.
      `IOException` - if error occurred during delete.

  - ### moveItem

    public void moveItem(String folderPath, String name, String newFolderPath, String newName) throws IOException, InvalidNameException
    Description copied from interface: `FileSystem`
    Moves the specified item to a new folder.
    Specified by:
      `moveItem` in interface `FileSystem`
    Overrides:
      `moveItem` in class `LocalFileSystem`
    Parameters:
      `folderPath` - path of folder containing the item.
      `name` - name of the item to be moved.
      `newFolderPath` - path of folder where item is to be moved.
    Throws:
      `FileNotFoundException` - if the item does not exist.
      `DuplicateFileException` - if item with the same name exists within the new parent folder.
      `FileInUseException` - if the item is in-use or checked-out
      `IOException` - if an IO error occurs.
      `InvalidNameException` - if the newName is invalid

  - ### moveFolder

    public void moveFolder(String parentPath, String folderName, String newParentPath) throws InvalidNameException, IOException
    Description copied from interface: `FileSystem`
    Move the specified folder to the path specified by newFolderPath. The moved folder must not be an ancestor of the new Parent.
    Parameters:
      `parentPath` - path of parent folder that the moving folder currently resides in.
      `folderName` - name of the folder within the parentPath to be moved.
      `newParentPath` - path to where the folder is to be moved.
    Throws:
      `InvalidNameException` - if the new FolderPath contains an illegal file name.
      `FileNotFoundException` - if the moved folder does not exist.
      `DuplicateFileException` - if folder with the same name exists within the new parent folder
      `FileInUseException` - if any file within this folder or its decendents are in-use or checked-out
      `IOException` - if an IO error occurs.

  - ### renameFolder

    public void renameFolder(String parentPath, String folderName, String newFolderName) throws InvalidNameException, IOException
    Description copied from interface: `FileSystem`
    Renames the specified folder to a new name.
    Parameters:
      `parentPath` - the parent folder of the folder to be renamed.
      `folderName` - the current name of the folder to be renamed.
      `newFolderName` - the name the folder to be renamed to.
    Throws:
      `InvalidNameException` - if the new FolderName contains an illegal file name.
      `FileNotFoundException` - if the folder to be renamed does not exist.
      `DuplicateFileException` - if folder with the new name already exists.
      `FileInUseException` - if any file within this folder or its decendents are in-use or checked-out
      `IOException` - if an IO error occurs.

  - ### folderExists

    public boolean folderExists(String folderPath)
    Description copied from interface: `FileSystem`
    Returns true if the folder specified by the path exists.
    Specified by:
      `folderExists` in interface `FileSystem`
    Specified by:
      `folderExists` in class `LocalFileSystem`
    Parameters:
      `folderPath` - the name of the folder to check for existence.
    Returns:
      true if the folder exists.

  - ### isIndexed

    public static boolean isIndexed(String rootPath)
    Determine if the specified directory corresponds to an indexed filesystem.
    Parameters:
      `rootPath` - filesystem root
    Returns:
      true if filesystem contains an index (not mangled)

  - ### hasIndexedStructure

    public static boolean hasIndexedStructure(String rootPath)
    Determine if the specified directory contains a likely indexed filesystem.
    Parameters:
      `rootPath` - filesystem root
    Returns:
      true if filesystem appears to be indexed (not mangled)

  - ### rebuild

    public static boolean rebuild(File rootDir) throws IOException
    Completely rebuild filesystem index using item information contained within indexed property files. Empty folders will be lost.
    Parameters:
      `rootDir` -
    Throws:
      `IOException`