Package ghidra.app.util.exporter
Class OriginalFileExporter
java.lang.Object
ghidra.app.util.exporter.Exporter
ghidra.app.util.exporter.OriginalFileExporter
- All Implemented Interfaces:
ExtensionPoint
An
Exporter
that can export the originally imported file
.
WARNING: Programs written to disk with this exporter may be runnable on your native platform. Use caution when exporting potentially malicious programs.
-
Field Summary
Fields inherited from class ghidra.app.util.exporter.Exporter
EMPTY_OPTIONS, log, provider
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canExportDomainObject
(DomainObject domainObject) Returns true if this exporter knows how to export the given domain object considering any constraints based on the specific makeup of the object.boolean
export
(File file, DomainObject domainObj, AddressSetView addrSet, TaskMonitor monitor) Actually does the work of exporting aDomainObject
.getOptions
(DomainObjectService domainObjectService) Returns the available options for this exporter.void
setOptions
(List<Option> opt) Sets the options.boolean
Returns true if this exporter can perform a restricted export of aDomainObject
based upon a specifiedAddressSetView
.Methods inherited from class ghidra.app.util.exporter.Exporter
canExportDomainFile, canExportDomainObject, export, getDefaultFileExtension, getHelpLocation, getMessageLog, getName, setExporterServiceProvider, toString
-
Constructor Details
-
OriginalFileExporter
public OriginalFileExporter()Creates a newOriginalFileExporter
-
-
Method Details
-
supportsAddressRestrictedExport
public boolean supportsAddressRestrictedExport()Description copied from class:Exporter
Returns true if this exporter can perform a restricted export of aDomainObject
based upon a specifiedAddressSetView
.- Overrides:
supportsAddressRestrictedExport
in classExporter
- Returns:
- true if this exporter can export less than the entire domain file.
-
canExportDomainObject
Description copied from class:Exporter
Returns true if this exporter knows how to export the given domain object considering any constraints based on the specific makeup of the object. This method should be used prior to exporting using theExporter.export(File, DomainObject, AddressSetView, TaskMonitor)
method.- Overrides:
canExportDomainObject
in classExporter
- Parameters:
domainObject
- the domain object to test for exporting.- Returns:
- true if this exporter knows how to export the given domain object.
-
export
public boolean export(File file, DomainObject domainObj, AddressSetView addrSet, TaskMonitor monitor) throws IOException, ExporterException Description copied from class:Exporter
Actually does the work of exporting aDomainObject
. Export will include all saved and unsaved modifications which may have been made to the object.- Specified by:
export
in classExporter
- 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 exported NOTE: seeExporter.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.
- Throws:
IOException
- if an IO error occursExporterException
- if export error occurs
-
getOptions
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 classExporter
- Parameters:
domainObjectService
- a service for retrieving the applicable domainObject.- Returns:
- the available options for this exporter
-
setOptions
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 classExporter
- Parameters:
opt
- the option values for this exporter
-