Class GdtExporter

java.lang.Object
ghidra.app.util.exporter.Exporter
ghidra.app.util.exporter.GdtExporter
All Implemented Interfaces:
ExtensionPoint

public class GdtExporter extends Exporter
  • Field Details

  • Constructor Details

    • GdtExporter

      public GdtExporter()
  • Method Details

    • canExportDomainObject

      public boolean canExportDomainObject(Class<? extends DomainObject> domainObjectClass)
      Description copied from class: Exporter
      Returns true if this exporter is capable of exporting the given domain file/object content type. For example, some exporters have the ability to export programs, other exporters can export project data type archives.

      NOTE: This method should only be used as a preliminary check, if neccessary, to identify exporter implementations that are capable of handling a specified content type/class. Prior to export a final check should be performed based on the export or either a DomainFile or DomainObject:

      DomainFile export - the method Exporter.canExportDomainFile(DomainFile) should be used to verify a direct project file export is possible using the Exporter.export(File, DomainFile, TaskMonitor) method.

      DomainObject export - the method Exporter.canExportDomainObject(DomainObject) should be used to verify an export of a specific object is possible using the Exporter.export(File, DomainObject, AddressSetView, TaskMonitor) method. avoid opening DomainFile when possible.

      Overrides:
      canExportDomainObject in class Exporter
      Parameters:
      domainObjectClass - the class of the domain object to test for exporting.
      Returns:
      true if this exporter knows how to export the given domain object type.
    • canExportDomainFile

      public boolean canExportDomainFile(DomainFile domainFile)
      Description copied from class: Exporter
      Returns true if exporter can export the specified DomainFile without instantiating a DomainObject. This method should be used prior to exporting using the Exporter.export(File, DomainFile, TaskMonitor) method. All exporter capable of a DomainFile export must also support a export of a DomainObject so that any possible data modification/upgrade is included within resulting export.
      Overrides:
      canExportDomainFile in class Exporter
      Parameters:
      domainFile - domain file
      Returns:
      true if export can occur else false if not
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • export

      public boolean export(File file, DomainObject domainObj, AddressSetView addrSet, TaskMonitor monitor)
      Description copied from class: Exporter
      Actually does the work of exporting a DomainObject. Export will include all saved and unsaved modifications which may have been made to the object.
      Specified by:
      export in class Exporter
      Parameters:
      file - the output file to write the exported info
      domainObj - the domain object to export
      addrSet - the address set if only a portion of the program should be exported NOTE: see Exporter.supportsAddressRestrictedExport().
      monitor - the task monitor
      Returns:
      true if the program was successfully exported; otherwise, false. If the program was not successfully exported, the message log should be checked to find the source of the error.
    • export

      public boolean export(File file, DomainFile domainFile, TaskMonitor monitor) throws ExporterException, IOException
      Description copied from class: Exporter
      Actually does the work of exporting a domain file, if supported (see Exporter.canExportDomainFile(DomainFile)). Export is performed without instantiation of a DomainObject.
      Overrides:
      export in class Exporter
      Parameters:
      file - the output file to write the exported info
      domainFile - the domain file to be exported (e.g., packed DB file)
      monitor - the task monitor
      Returns:
      true if the file was successfully exported; otherwise, false. If the file was not successfully exported, the message log should be checked to find the source of the error.
      Throws:
      ExporterException - if export error occurs
      IOException - if an IO error occurs
    • getOptions

      public List<Option> getOptions(DomainObjectService domainObjectService)
      Description copied from class: Exporter
      Returns the available options for this exporter. The program is needed because some exporters may have options that vary depending on the specific program being exported.
      Specified by:
      getOptions in class Exporter
      Parameters:
      domainObjectService - a service for retrieving the applicable domainObject.
      Returns:
      the available options for this exporter
    • setOptions

      public void setOptions(List<Option> options)
      Description copied from class: Exporter
      Sets the options. This method is not for defining the options, but rather it is for setting the values of options. If invalid options are passed in, then OptionException should be thrown.
      Specified by:
      setOptions in class Exporter
      Parameters:
      options - the option values for this exporter
    • supportsAddressRestrictedExport

      public boolean supportsAddressRestrictedExport()
      Returns false. GDT export only supports entire database.
      Overrides:
      supportsAddressRestrictedExport in class Exporter
      Returns:
      true if this exporter can export less than the entire domain file.