Class GdtLoader

  • All Implemented Interfaces:
    Loader, ExtensionPoint, java.lang.Comparable<Loader>

    public class GdtLoader
    extends java.lang.Object
    implements Loader
    Loads a packed Ghidra data type archive.
    • Constructor Detail

      • GdtLoader

        public GdtLoader()
    • Method Detail

      • getDefaultOptions

        public java.util.List<Option> getDefaultOptions​(ByteProvider provider,
                                                        LoadSpec loadSpec,
                                                        DomainObject domainObject,
                                                        boolean loadIntoProgram)
        Description copied from interface: Loader
        Gets the default Loader options.
        Specified by:
        getDefaultOptions in interface Loader
        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.
      • loadInto

        public boolean loadInto​(ByteProvider provider,
                                LoadSpec loadSpec,
                                java.util.List<Option> options,
                                MessageLog messageLog,
                                Program program,
                                TaskMonitor monitor)
                         throws java.io.IOException,
                                CancelledException
        Description copied from interface: Loader
        Loads bytes into the specified Program. This method will not create any new Programs. It is only for adding to an existing Program.
        Specified by:
        loadInto in interface Loader
        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.
      • validateOptions

        public java.lang.String validateOptions​(ByteProvider provider,
                                                LoadSpec loadSpec,
                                                java.util.List<Option> options,
                                                Program program)
        Description copied from interface: Loader
        Validates the Loader's options and returns null if all options are valid; otherwise, an error message describing the problem is returned.
        Specified by:
        validateOptions in interface Loader
        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.
      • findSupportedLoadSpecs

        public java.util.Collection<LoadSpec> findSupportedLoadSpecs​(ByteProvider provider)
                                                              throws java.io.IOException
        Description copied from interface: Loader
        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.
        Specified by:
        findSupportedLoadSpecs in interface Loader
        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.
      • getPreferredFileName

        public java.lang.String getPreferredFileName​(ByteProvider provider)
        Description copied from interface: Loader
        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.

        Specified by:
        getPreferredFileName in interface Loader
        Parameters:
        provider - The bytes to load.
        Returns:
        The preferred file name to use when loading.
      • getName

        public java.lang.String getName()
        Description copied from interface: Loader
        Gets the Loader's name, which is used both for display purposes, and to identify the Loader in the opinion files.
        Specified by:
        getName in interface Loader
        Returns:
        The Loader's name.
      • getTier

        public LoaderTier getTier()
        Description copied from interface: Loader
        For ordering purposes; lower tier numbers are more important (and listed first).
        Specified by:
        getTier in interface Loader
        Returns:
        the tier of the loader
      • getTierPriority

        public int getTierPriority()
        Description copied from interface: Loader
        For ordering purposes; lower numbers are more important (and listed first, within its tier).
        Specified by:
        getTierPriority in interface Loader
        Returns:
        the ordering of the loader within its tier