Package ghidra.app.util.exporter
Class Exporter
- java.lang.Object
-
- ghidra.app.util.exporter.Exporter
-
- All Implemented Interfaces:
ExtensionPoint
- Direct Known Subclasses:
AsciiExporter
,BinaryExporter
,GzfExporter
,HtmlExporter
,IntelHexExporter
,ProjectArchiveExporter
,XmlExporter
public abstract class Exporter extends java.lang.Object implements ExtensionPoint
The interface that all exporters must implement.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ghidra.util.classfinder.ExtensionPoint
ExtensionPoint.Exclude, ExtensionPoint.Util
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.List<Option>
EMPTY_OPTIONS
protected MessageLog
log
protected ServiceProvider
provider
-
Constructor Summary
Constructors Modifier Constructor Description protected
Exporter(java.lang.String name, java.lang.String extension, HelpLocation help)
Constructs a new exporter.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canExportDomainObject(java.lang.Class<? extends DomainObject> domainObjectClass)
Returns true if this exporter knows how to export the given domain object.abstract boolean
export(java.io.File file, DomainObject domainObj, AddressSetView addrSet, TaskMonitor monitor)
Actually does the work of exporting the program.java.lang.String
getDefaultFileExtension()
Returns the default extension for this exporter.HelpLocation
getHelpLocation()
Returns the help location for this exporter.MessageLog
getMessageLog()
Returns the message log the may have been created during an export.java.lang.String
getName()
Returns the display name of this exporter.abstract java.util.List<Option>
getOptions(DomainObjectService domainObjectService)
Returns the available options for this exporter.void
setExporterServiceProvider(ServiceProvider provider)
Sets the exporter service provider.abstract void
setOptions(java.util.List<Option> options)
Sets the options.boolean
supportsPartialExport()
Returns true if this exporter can export less than the entire domain file.java.lang.String
toString()
-
-
-
Field Detail
-
EMPTY_OPTIONS
protected static final java.util.List<Option> EMPTY_OPTIONS
-
log
protected MessageLog log
-
provider
protected ServiceProvider provider
-
-
Constructor Detail
-
Exporter
protected Exporter(java.lang.String name, java.lang.String extension, HelpLocation help)
Constructs a new exporter.- Parameters:
name
- the display name of this exporterextension
- the default extension for this exporterhelp
- the help location for this exporter
-
-
Method Detail
-
getName
public final java.lang.String getName()
Returns the display name of this exporter.- Returns:
- the display name of this exporter
-
getDefaultFileExtension
public final java.lang.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(java.lang.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:
domainObject
- 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 java.util.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(java.util.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(java.io.File file, DomainObject domainObj, AddressSetView addrSet, TaskMonitor monitor) throws ExporterException, java.io.IOException
Actually does the work of exporting the program.- Parameters:
file
- the output file to write the exported infodomainObj
- the domain object to exportaddrSet
- the address set if only a portion of the program should be exportedmonitor
- 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
java.io.IOException
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-