public static LoadResults<Program> importFresh(ByteProvider provider, Project project,
			String projectFolderPath, Object consumer, MessageLog messageLog, TaskMonitor monitor,
			Predicate<Loader> loaderFilter, LoadSpecChooser loadSpecChooser,
			String importNameOverride, OptionChooser optionChooser) throws IOException,
			CancelledException, DuplicateNameException, InvalidNameException, VersionException,
			LoadException {

		if (provider == null) {
			throw new LoadException("Cannot load null provider");
		}

		// Get the load spec
		LoadSpec loadSpec = getLoadSpec(loaderFilter, loadSpecChooser, provider);
		if (loadSpec == null) {
			throw new LoadException("No load spec found");
		}

		// Get the preferred import name
		String importName = loadSpec.getLoader().getPreferredFileName(provider);
		if (importNameOverride != null) {
			importName = importNameOverride;
		}

		// Collect options
		LanguageCompilerSpecPair languageCompilerSpecPair = loadSpec.getLanguageCompilerSpec();
		AddressFactory addrFactory = null;// Address type options not permitted if null
		if (languageCompilerSpecPair != null) {
			// It is assumed that if languageCompilerSpecPair exists, then language will be found
			addrFactory = DefaultLanguageService.getLanguageService()
					.getLanguage(
						languageCompilerSpecPair.languageID)
					.getAddressFactory();
		}
		List<Option> loaderOptions = optionChooser.choose(
			loadSpec.getLoader().getDefaultOptions(provider, loadSpec, null, false), addrFactory);
		if (loaderOptions == null) {
			throw new LoadException("Cannot load with null options");
		}

		// Import
		Msg.info(AutoImporter.class, "Using Loader: " + loadSpec.getLoader().getName());
		Msg.info(AutoImporter.class,
			"Using Language/Compiler: " + loadSpec.getLanguageCompilerSpec());
		Msg.info(AutoImporter.class, "Using Library Search Path: " +
			Arrays.toString(LibrarySearchPathManager.getLibraryPaths()));
		LoadResults<? extends DomainObject> loadResults = loadSpec.getLoader()
				.load(provider, importName, project, projectFolderPath, loadSpec, loaderOptions,
					messageLog, consumer, monitor);

		// Optionally echo loader message log to application.log
		if (!Loader.loggingDisabled && messageLog.hasMessages()) {
			Msg.info(AutoImporter.class, "Additional info:\n" + messageLog.toString());
		}

		// Filter out and release non-Programs
		List<Loaded<Program>> loadedPrograms = new ArrayList<>();
		for (Loaded<? extends DomainObject> loaded : loadResults) {
			if (loaded.getDomainObject() instanceof Program program) {
				loadedPrograms.add(
					new Loaded<Program>(program, loaded.getName(), loaded.getProjectFolderPath()));
			}
			else {
				loaded.release(consumer);
			}
		}
		if (loadedPrograms.isEmpty()) {
			throw new LoadException("Domain objects were loaded, but none were Programs");
		}
		return new LoadResults<>(loadedPrograms);
	}
Automatically imports the given {@link ByteProvider bytes} with advanced options.
<p>
Note that when the import completes, the returned {@link Loaded} {@link Program}s are not 
saved to a project.  That is the responsibility of the caller (see 
{@link LoadResults#save(Project, Object, MessageLog, TaskMonitor)}).
<p>
It is also the responsibility of the caller to release the returned {@link Loaded} 
{@link Program}s with {@link LoadResults#release(Object)} when they are no longer needed.

@param provider The bytes to import
@param project The {@link Project}.  Loaders can use this to take advantage of existing
  {@link DomainFolder}s and {@link DomainFile}s to do custom behaviors such as loading
  libraries. Could be null if there is no project.
@param projectFolderPath A suggested project folder path for the {@link Loaded} 
  {@link Program}s. This is just a suggestion, and a {@link Loader} implementation 
  reserves the right to change it for each {@link Loaded} result. The {@link Loaded} results 
  should be queried for their true project folder paths using 
  {@link Loaded#getProjectFolderPath()}.
@param loaderFilter A {@link Predicate} used to choose what {@link Loader}(s) get used
@param loadSpecChooser A {@link LoadSpecChooser} used to choose what {@link LoadSpec}(s) get
  used
@param importNameOverride The name to use for the imported thing.  Null to use the 
  {@link Loader}'s preferred name.
@param optionChooser A {@link OptionChooser} used to choose what {@link Loader} options get
  used
@param consumer A consumer
@param messageLog The log
@param monitor A task monitor
@return The {@link LoadResults} which contains one ore more {@link Loaded} {@link Program}s 
  (created but not saved)
@throws IOException if there was an IO-related problem loading
@throws CancelledException if the operation was cancelled 
@throws DuplicateNameException if the load resulted in a {@link Program} naming conflict
@throws InvalidNameException if an invalid {@link Program} name was used during load
@throws VersionException if there was an issue with database versions, probably due to a 
  failed language upgrade
@throws LoadException if nothing was loaded
Ghidra/Features/Base/src/main/java/ghidra/app/util/importer/AutoImporter.java