Interface Loader

All Superinterfaces:
Comparable<Loader>, ExtensionPoint
All Known Implementing Classes:
AbstractLibrarySupportLoader, AbstractOrdinalSupportLoader, AbstractProgramLoader, AbstractProgramWrapperLoader, BinaryLoader, CoffLoader, DbgLoader, DefLoader, DyldCacheLoader, ElfLoader, GdtLoader, GzfLoader, IntelHexLoader, MachoLoader, MapLoader, MotorolaHexLoader, MSCoffLoader, MzLoader, NeLoader, OmfLoader, PefLoader, PeLoader, XmlLoader

public interface Loader extends ExtensionPoint, Comparable<Loader>
An interface that all loaders must implement. A particular loader implementation should be designed to identify one and only one file format.

NOTE: ALL loader CLASSES MUST END IN "Loader". If not, the ClassSearcher will not find them.

  • Field Details

  • Method Details

    • findSupportedLoadSpecs

      Collection<LoadSpec> findSupportedLoadSpecs(ByteProvider provider) throws IOException
      If this Loader supports loading the given ByteProvider, this methods returns a Collection of all supported LoadSpecs 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.
      Parameters:
      provider - The bytes being loaded.
      Returns:
      A Collection of LoadSpecs 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 LoadSpecs.
    • load

      Loads bytes in a particular format as a new DomainObject. Multiple DomainObjects may end up getting created, depending on the nature of the format.
      Parameters:
      provider - The bytes to load.
      name - The name of the thing that's being loaded.
      folder - The DomainFolder where the loaded thing should be saved. Could be null if the thing should not be pre-saved.
      loadSpec - The LoadSpec to use during load.
      options - The load options.
      messageLog - The message log.
      consumer - A consumer object for DomainObject generated.
      monitor - A cancelable task monitor.
      Returns:
      A list of loaded DomainObjects (element 0 corresponds to primary loaded object).
      Throws:
      IOException - if there was an IO-related problem loading.
      CancelledException - if the user cancelled the load.
      DuplicateNameException - if the load resulted in a naming conflict with the DomainObject.
      InvalidNameException - if an invalid DomainObject name was used during load.
      VersionException - if there was an issue with database versions, probably due to a failed language upgrade.
    • loadInto

      boolean loadInto(ByteProvider provider, LoadSpec loadSpec, List<Option> options, MessageLog messageLog, Program program, TaskMonitor monitor) throws IOException, CancelledException
      Loads bytes into the specified Program. This method will not create any new Programs. It is only for adding to an existing Program.
      Parameters:
      provider - The bytes to load into the Program.
      loadSpec - The LoadSpec to use during load.
      options - The load options.
      messageLog - The message log.
      program - The Program to load into.
      monitor - A cancelable task monitor.
      Returns:
      True if the file was successfully loaded; otherwise, false.
      Throws:
      IOException - if there was an IO-related problem loading.
      CancelledException - if the user cancelled the load.
    • getDefaultOptions

      List<Option> getDefaultOptions(ByteProvider provider, LoadSpec loadSpec, DomainObject domainObject, boolean loadIntoProgram)
      Gets the default Loader options.
      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.
      Returns:
      A list of the Loader's default options.
    • validateOptions

      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.
      Parameters:
      provider - The bytes of the thing being loaded.
      loadSpec - The proposed LoadSpec.
      options - The list of Options 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 Options are valid; otherwise, an error message describing the problem is returned.
    • getName

      String getName()
      Gets the Loader's name, which is used both for display purposes, and to identify the Loader in the opinion files.
      Returns:
      The Loader's name.
    • getTier

      LoaderTier getTier()
      For ordering purposes; lower tier numbers are more important (and listed first).
      Returns:
      the tier of the loader
    • getTierPriority

      int getTierPriority()
      For ordering purposes; lower numbers are more important (and listed first, within its tier).
      Returns:
      the ordering of the loader within its tier
    • getPreferredFileName

      default String getPreferredFileName(ByteProvider provider)
      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.

      Parameters:
      provider - The bytes to load.
      Returns:
      The preferred file name to use when loading.
    • supportsLoadIntoProgram

      default boolean supportsLoadIntoProgram()
      Checks to see if this Loader supports loading into an existing Program.

      The default behavior of this method is to return false.

      Returns:
      True if this Loader supports loading into an existing Program; otherwise, false.
    • compareTo

      default int compareTo(Loader o)
      Specified by:
      compareTo in interface Comparable<Loader>