Package ghidra.formats.gfilesystem

# Class FSRLRoot

java.lang.Object
ghidra.formats.gfilesystem.FSRL
ghidra.formats.gfilesystem.FSRLRoot

public class FSRLRoot extends FSRL
A type of `FSRL` that is specific to the filesystem's identity. A FSRL's parent is always a FSRLRoot.

A FSRLRoot's parent is always a FSRL (ie. the container the filesystem data is in), or null.

Examples of relationship between FSRL and FSRLRoots:

- FSRLRoot [ file:// ]
  "file://"
- FSRLRoot [ file:// ] <---- FSRL [ /filename.txt ]
  "file:///filename.txt"
- FSRLRoot [ file:// ] <---- FSRL [ /filename.txt ] <--- FSRLRoot [ subfs:// ]
  "file:///filename.txt|subfs://"

- ## Field Summary

  ### Fields inherited from class ghidra.formats.gfilesystem.FSRL

  `PARAM_MD5, parent, path`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `appendToStringBuilder(StringBuilder sb, boolean recurse, boolean includeParams, boolean includeFSRoot)`
  `FSRL`
  `getContainer()`
  Returns the parent containerfile FSRL, or null if this FSRLRoot specifies a root-level filesystem.
  `FSRLRoot`
  `getFS()`
  Returns the `FSRLRoot` object that represents the entire `filesystem` for this FSRL.
  `String`
  `getName()`
  Always returns null for a FSRLRoot.
  `String`
  `getPath()`
  Always returns null for a FSRLRoot.
  `String`
  `getProtocol()`
  Returns the "protocol" portion of this FSRLRoot, for example, in a FSRLRoot of "file://", this method would return "file".
  `boolean`
  `hasContainer()`
  Returns true if there is a parent containerfile, or false if this FSRLRoot specifies a root-level filesystem.
  `int`
  `hashCode()`
  `static FSRLRoot`
  `makeRoot(String protocol)`
  Creates a `FSRLRoot` without a parent container, using the supplied `protocol` string as its type.
  `static FSRLRoot`
  `nestedFS(FSRL containerFile, FSRLRoot copyFSRL)`
  Create a copy of `copyFSRL`, but using a different `containerFile` parent.
  `static FSRLRoot`
  `nestedFS(FSRL containerFile, String fstype)`
  Creates a `FSRLRoot` as a child of a container `FSRL`, using the supplied `protocol` string as its type.
  `FSRL`
  `withPathMD5(String newPath, String newMD5)`
  Creates a new `FSRL` as a child of this `FSRLRoot`, using the supplied path and MD5 values.

  ### Methods inherited from class ghidra.formats.gfilesystem.FSRL

  `appendPath, convertRootToContainer, equals, fromProgram, fromString, fromString, getMD5, getName, getNestingDepth, isDescendantOf, isEquivalent, isEquivalent, isMD5Equal, makeNested, split, toPrettyFullpathString, toPrettyString, toString, toStringPart, withMD5, withPath, withPath`

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

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### makeRoot

    public static FSRLRoot makeRoot(String protocol)
    Creates a `FSRLRoot` without a parent container, using the supplied `protocol` string as its type.
    Parameters:
      `protocol` - string protocol name
    Returns:
      new `FSRLRoot` instance.

  - ### nestedFS

    public static FSRLRoot nestedFS(FSRL containerFile, String fstype)
    Creates a `FSRLRoot` as a child of a container `FSRL`, using the supplied `protocol` string as its type.
    Parameters:
      `containerFile` - `FSRL` of the container that contains this nested filesystem.
      `fstype` - the filesystem type.
    Returns:
      new `FSRLRoot` instance with a parent pointing to the specified containerFile.

  - ### nestedFS

    public static FSRLRoot nestedFS(FSRL containerFile, FSRLRoot copyFSRL)
    Create a copy of `copyFSRL`, but using a different `containerFile` parent.

    (ie. re-parents copyFSRL so its parent is containerFile)

    Parameters:
      `containerFile` - `FSRL` of new parent
      `copyFSRL` - `FSRLRoot` that will be copied and re-parented.
    Returns:
      new `FSRLRoot`

  - ### getFS

    public FSRLRoot getFS()
    Description copied from class: `FSRL`
    Returns the `FSRLRoot` object that represents the entire `filesystem` for this FSRL.

    Never returns NULL, and calling getFS() on a `FSRLRoot` object returns itself.

    Overrides:
      `getFS` in class `FSRL`
    Returns:
      `FSRLRoot` instance that is the parent of this `FSRL`, never null.

  - ### getProtocol

    public String getProtocol()
    Returns the "protocol" portion of this FSRLRoot, for example, in a FSRLRoot of "file://", this method would return "file".

    Returns:
      string protocol / filesystem type.

  - ### getContainer

    public FSRL getContainer()
    Returns the parent containerfile FSRL, or null if this FSRLRoot specifies a root-level filesystem.

    Returns:
      `FSRL` of the container object that this filesystem is nested under.

  - ### hasContainer

    public boolean hasContainer()
    Returns true if there is a parent containerfile, or false if this FSRLRoot specifies a root-level filesystem.
    Returns:
      boolean true if this `FSRLRoot` has a parent container, or false if not.

  - ### getPath

    public String getPath()
    Always returns null for a FSRLRoot.
    Overrides:
      `getPath` in class `FSRL`
    Returns:
      null because this is a `FSRLRoot` instance which never has paths.

  - ### getName

    public String getName()
    Always returns null for a FSRLRoot.
    Overrides:
      `getName` in class `FSRL`
    Returns:
      null because this is a `FSRLRoot` instance which never has a path and therefore doesn't have a name part of a path.

  - ### withPathMD5

    public FSRL withPathMD5(String newPath, String newMD5)
    Creates a new `FSRL` as a child of this `FSRLRoot`, using the supplied path and MD5 values.

    Parameters:
      `newPath` - string path and filename of the object inside this filesystem, should not be null.
      `newMD5` - string md5 of the object inside this filesystem, null ok.
    Returns:
      new `FSRL` instance which is a child of this `FSRLRoot`.

  - ### appendToStringBuilder

    protected void appendToStringBuilder(StringBuilder sb, boolean recurse, boolean includeParams, boolean includeFSRoot)
    Overrides:
      `appendToStringBuilder` in class `FSRL`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `FSRL`