diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractProgramWrapperLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractProgramWrapperLoader.java new file mode 100644 index 0000000000..b13c7d3274 --- /dev/null +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractProgramWrapperLoader.java @@ -0,0 +1,112 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.app.util.opinion; + +import java.io.IOException; +import java.util.List; + +import ghidra.app.util.Option; +import ghidra.app.util.bin.ByteProvider; +import ghidra.app.util.importer.MessageLog; +import ghidra.framework.model.DomainFolder; +import ghidra.program.model.address.Address; +import ghidra.program.model.lang.*; +import ghidra.program.model.listing.Program; +import ghidra.util.exception.CancelledException; +import ghidra.util.task.TaskMonitor; + +/** + * An abstract {@link Loader} that provides a convenience wrapper around + * {@link AbstractProgramLoader}, minimizing the amount of work a subclass needs to do to load a + * {@link Program} + */ +public abstract class AbstractProgramWrapperLoader extends AbstractProgramLoader { + + /** + * Loads bytes in a particular format into the given {@link Program}. + * + * @param provider The bytes to load. + * @param loadSpec The {@link LoadSpec} to use during load. + * @param options The load options. + * @param program The {@link Program} to load into. + * @param monitor A cancelable task monitor. + * @param log The message log. + * @throws IOException if there was an IO-related problem loading. + * @throws CancelledException if the user cancelled the load. + */ + protected abstract void load(ByteProvider provider, LoadSpec loadSpec, List