Package ghidra.app.util.opinion

# Class GzfLoader

java.lang.Object
ghidra.app.util.opinion.GzfLoader

All Implemented Interfaces:
  `Loader`, `ExtensionPoint`, `Comparable<Loader>`

public class GzfLoader extends Object implements Loader
Loads a packed Ghidra program.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface ghidra.app.util.opinion.Loader

  `Loader.ImporterSettings`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `GZF_NAME`

  ### Fields inherited from interface ghidra.app.util.opinion.Loader

  `COMMAND_LINE_ARG_PREFIX, loggingDisabled, OPTIONS_PROJECT_SAVE_STATE_KEY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GzfLoader()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Collection<LoadSpec>`
  `findSupportedLoadSpecs(ByteProvider provider)`
  If this `Loader` supports loading the given `ByteProvider`, this methods returns a `Collection` of all supported `LoadSpec`s that contain discovered load specification information that this `Loader` will need to load.
  `List<Option>`
  `getDefaultOptions(ByteProvider provider, LoadSpec loadSpec, DomainObject domainObject, boolean loadIntoProgram, boolean mirrorFsLayout)`
  Gets the default `Loader` options.
  `String`
  `getName()`
  Gets the `Loader`'s name, which is used both for display purposes, and to identify the `Loader` in the opinion files.
  `String`
  `getPreferredFileName(ByteProvider provider)`
  The preferred file name to use when loading.
  `LoaderTier`
  `getTier()`
  For ordering purposes; lower tier numbers are more important (and listed first).
  `int`
  `getTierPriority()`
  For ordering purposes; lower numbers are more important (and listed first, within its tier).
  `LoadResults<? extends DomainObject>`
  `load(Loader.ImporterSettings settings)`
  Loads bytes in a particular format as a new `Loaded` `DomainObject`.
  `void`
  `loadInto(Program program, Loader.ImporterSettings settings)`
  Loads bytes into the specified `Program`.
  `String`
  `validateOptions(ByteProvider provider, LoadSpec loadSpec, List<Option> options, Program program)`
  Validates the `Loader`'s options and returns null if all options are valid; otherwise, an error message describing the problem is returned.

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

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

  ### Methods inherited from interface ghidra.app.util.opinion.Loader

  `compareTo, loadsIntoNewFolder, supportsLoadIntoProgram, supportsLoadIntoProgram`

- ## Field Details

  - ### GZF_NAME

    public static final String GZF_NAME
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### GzfLoader

    public GzfLoader()

- ## Method Details

  - ### getTier

    public LoaderTier getTier()
    Description copied from interface: `Loader`
    For ordering purposes; lower tier numbers are more important (and listed first).
    Specified by:
      `getTier` in interface `Loader`
    Returns:
      the tier of the loader

  - ### getTierPriority

    public int getTierPriority()
    Description copied from interface: `Loader`
    For ordering purposes; lower numbers are more important (and listed first, within its tier).
    Specified by:
      `getTierPriority` in interface `Loader`
    Returns:
      the ordering of the loader within its tier

  - ### validateOptions

    public String validateOptions(ByteProvider provider, LoadSpec loadSpec, List<Option> options, Program program)
    Description copied from interface: `Loader`
    Validates the `Loader`'s options and returns null if all options are valid; otherwise, an error message describing the problem is returned.
    Specified by:
      `validateOptions` in interface `Loader`
    Parameters:
      `provider` - The bytes of the thing being loaded.
      `loadSpec` - The proposed `LoadSpec`.
      `options` - The list of `Option`s to validate.
      `program` - existing program if the loader is adding to an existing program. If it is a fresh import, then this will be null.
    Returns:
      null if all `Option`s are valid; otherwise, an error message describing the problem is returned.

  - ### getDefaultOptions

    public List<Option> getDefaultOptions(ByteProvider provider, LoadSpec loadSpec, DomainObject domainObject, boolean loadIntoProgram, boolean mirrorFsLayout)
    Description copied from interface: `Loader`
    Gets the default `Loader` options.
    Specified by:
      `getDefaultOptions` in interface `Loader`
    Parameters:
      `provider` - The bytes of the thing being loaded.
      `loadSpec` - The `LoadSpec`.
      `domainObject` - The `DomainObject` being loaded.
      `loadIntoProgram` - True if the load is adding to an existing `DomainObject`; otherwise, false.
      `mirrorFsLayout` - True if the filesystem layout should be mirrored when loading; otherwise, false
    Returns:
      A list of the `Loader`'s default options.

  - ### load

    public LoadResults<? extends DomainObject> load(Loader.ImporterSettings settings) throws IOException, CancelledException, VersionException
    Description copied from interface: `Loader`
    Loads bytes in a particular format as a new `Loaded` `DomainObject`. Multiple `DomainObject`s may end up getting created, depending on the nature of the format. The `Loaded` `DomainObject`s are bundled together in a `LoadResults` object which provides convenience methods to operate on the entire group of `Loaded` `DomainObject`s.

    Note that when the load completes, the returned `Loaded` `DomainObject`s are not saved to a project. That is the responsibility of the caller (see `LoadResults.save(TaskMonitor)`).

    It is also the responsibility of the caller to close the returned `Loaded` `DomainObject`s with `LoadResults.close()` when they are no longer needed.

    Specified by:
      `load` in interface `Loader`
    Parameters:
      `settings` - The `Loader.ImporterSettings`.
    Returns:
      The `LoadResults` which contains one or more `Loaded` `DomainObject`s (created but not saved).
    Throws:
      `IOException` - if there was an IO-related problem loading.
      `CancelledException` - if the user cancelled the load.
      `VersionException` - if the load process tried to open an existing `DomainFile` which was created with a newer or unsupported version of Ghidra

  - ### loadInto

    public void loadInto(Program program, Loader.ImporterSettings settings) throws IOException, LoadException, CancelledException
    Description copied from interface: `Loader`
    Loads bytes into the specified `Program`. This method will not create any new `Program`s. It is only for adding to an existing `Program`.
    Specified by:
      `loadInto` in interface `Loader`
    Parameters:
      `program` - The `Program` to load into.
      `settings` - The `Loader.ImporterSettings`.
    Throws:
      `IOException` - if there was an IO-related problem loading.
      `LoadException` - if the load failed in an expected way.
      `CancelledException` - if the user cancelled the load.

  - ### findSupportedLoadSpecs

    public Collection<LoadSpec> findSupportedLoadSpecs(ByteProvider provider) throws IOException
    Description copied from interface: `Loader`
    If this `Loader` supports loading the given `ByteProvider`, this methods returns a `Collection` of all supported `LoadSpec`s that contain discovered load specification information that this `Loader` will need to load. If this `Loader` cannot support loading the given `ByteProvider`, an empty `Collection` is returned.
    Specified by:
      `findSupportedLoadSpecs` in interface `Loader`
    Parameters:
      `provider` - The bytes being loaded.
    Returns:
      A `Collection` of `LoadSpec`s that this `Loader` supports loading, or an empty `Collection` if this `Loader` doesn't support loading the given `ByteProvider`.
    Throws:
      `IOException` - if there was an IO-related issue finding the `LoadSpec`s.

  - ### getPreferredFileName

    public String getPreferredFileName(ByteProvider provider)
    Description copied from interface: `Loader`
    The preferred file name to use when loading.

    The default behavior of this method is to return the (cleaned up) name of the given `ByteProvider`.

    NOTE: This method may get called frequently, so only parse the given `ByteProvider` if absolutely necessary.

    Specified by:
      `getPreferredFileName` in interface `Loader`
    Parameters:
      `provider` - The bytes to load.
    Returns:
      The preferred file name to use when loading, or `null` if a name could not be determined from the provider.

  - ### getName

    public String getName()
    Description copied from interface: `Loader`
    Gets the `Loader`'s name, which is used both for display purposes, and to identify the `Loader` in the opinion files.
    Specified by:
      `getName` in interface `Loader`
    Returns:
      The `Loader`'s name.