Class MachoLoader

    • Constructor Detail

      • MachoLoader

        public MachoLoader()
    • Method Detail

      • 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.
        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.
      • 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.
        Returns:
        The Loader's name.
      • importLibrary

        protected boolean importLibrary​(java.lang.String libName,
                                        DomainFolder libFolder,
                                        java.io.File libFile,
                                        LoadSpec loadSpec,
                                        java.util.List<Option> options,
                                        MessageLog log,
                                        java.lang.Object consumer,
                                        java.util.Set<java.lang.String> unprocessedLibs,
                                        java.util.List<Program> programList,
                                        TaskMonitor monitor)
                                 throws CancelledException,
                                        java.io.IOException
        Overrides the default implementation to account for Universal Binary (UBI) files. These must be specially parsed to find the internal file matching the current architecture.

        FatHeader is used to parse the file to determine if it is a UBI. If so, each file within the archive is run through the import process until one is found that is successful (meaning it matches the correct architecture). Only one file in the UBI will ever be imported. If the provided file is NOT a UBI, default import method will be invoked.

        Overrides:
        importLibrary in class AbstractLibrarySupportLoader
        Parameters:
        libName - the name of the library to import
        libFolder - the library folder
        libFile - the library file to load
        loadSpec - the LoadSpec
        options - the load options
        log - the message log
        consumer - consumer object for the Program generated
        unprocessedLibs - list of libraries that need to be loaded
        programList - list of programs to add the imported library to
        monitor - the task monitor
        Returns:
        true if the load was successful
        Throws:
        CancelledException - if the user cancelled the load operation
        java.io.IOException - if there was an error during the load