Class Exporter

java.lang.Object
ghidra.app.util.exporter.Exporter
All Implemented Interfaces:
ExtensionPoint
Direct Known Subclasses:
AbstractLoaderExporter, AsciiExporter, BinaryExporter, CppExporter, GzfExporter, HtmlExporter, IntelHexExporter, ProjectArchiveExporter, XmlExporter

public abstract class Exporter extends Object implements ExtensionPoint
The interface that all exporters must implement.
  • Field Details

  • Constructor Details

    • Exporter

      protected Exporter(String name, String extension, HelpLocation help)
      Constructs a new exporter.
      Parameters:
      name - the display name of this exporter
      extension - the default extension for this exporter
      help - the help location for this exporter
  • Method Details

    • getName

      public final String getName()
      Returns the display name of this exporter.
      Returns:
      the display name of this exporter
    • getDefaultFileExtension

      public final String getDefaultFileExtension()
      Returns the default extension for this exporter. For example, .html for .xml.
      Returns:
      the default extension for this exporter
    • getHelpLocation

      public final HelpLocation getHelpLocation()
      Returns the help location for this exporter. It should return null only if no help documentation exists.
      Returns:
      the help location for this exporter
    • getMessageLog

      public final MessageLog getMessageLog()
      Returns the message log the may have been created during an export. The message log is used to log warnings and other non-critical messages.
      Returns:
      the message log
    • setExporterServiceProvider

      public final void setExporterServiceProvider(ServiceProvider provider)
      Sets the exporter service provider.
      Parameters:
      provider - the exporter service provider
    • canExportDomainObject

      public boolean canExportDomainObject(Class<? extends DomainObject> domainObjectClass)
      Returns true if this exporter knows how to export the given domain object. For example, some exporters know how to export programs, other exporters can export project data type archives.
      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.
    • supportsPartialExport

      public boolean supportsPartialExport()
      Returns true if this exporter can export less than the entire domain file.
      Returns:
      true if this exporter can export less than the entire domain file.
    • getOptions

      public abstract List<Option> getOptions(DomainObjectService domainObjectService)
      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.
      Parameters:
      domainObjectService - a service for retrieving the applicable domainObject.
      Returns:
      the available options for this exporter
    • setOptions

      public abstract void setOptions(List<Option> options) throws OptionException
      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.
      Parameters:
      options - the option values for this exporter
      Throws:
      OptionException - if invalid options are passed in
    • export

      public abstract boolean export(File file, DomainObject domainObj, AddressSetView addrSet, TaskMonitor monitor) throws ExporterException, IOException
      Actually does the work of exporting the program.
      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
      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.
      Throws:
      ExporterException
      IOException
    • toString

      public final String toString()
      Overrides:
      toString in class Object