Interface Loader

    • Field Detail

      • COMMAND_LINE_ARG_PREFIX

        static final java.lang.String COMMAND_LINE_ARG_PREFIX
        See Also:
        Constant Field Values
    • Method Detail

      • findSupportedLoadSpecs

        java.util.Collection<LoadSpec> findSupportedLoadSpecs​(ByteProvider provider)
                                                       throws java.io.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:
        java.io.IOException - if there was an IO-related issue finding the LoadSpecs.
      • loadInto

        boolean loadInto​(ByteProvider provider,
                         LoadSpec loadSpec,
                         java.util.List<Option> options,
                         MessageLog messageLog,
                         Program program,
                         TaskMonitor monitor)
                  throws java.io.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:
        java.io.IOException - if there was an IO-related problem loading.
        CancelledException - if the user cancelled the load.
      • getDefaultOptions

        java.util.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

        java.lang.String validateOptions​(ByteProvider provider,
                                         LoadSpec loadSpec,
                                         java.util.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

        java.lang.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 java.lang.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 java.lang.Comparable<Loader>