@Override
			public void run(TaskMonitor monitor) throws CancelledException {

				for (File f : files) {
					monitor.checkCancelled();

					// Test for Packed DB file using ItemDeserializer
					ItemDeserializer itemDeserializer = null;
					try {
						itemDeserializer = new ItemDeserializer(f); // fails for non-packed file
					}
					catch (IOException e) {
						remainingFiles.add(f);
						continue; // not a Packed DB - skip file
					}
					finally {
						if (itemDeserializer != null) {
							itemDeserializer.dispose();
						}
					}

					monitor.setMessage("Unpacking " + f.getName() + " ...");

					// Perform direct unpack of Packed DB file
					String filename = makeValidUniqueFilename(f.getName(), folder);
					try {
						DomainFile df = folder.createFile(filename, f, monitor);
						Msg.info(this, "Imported " + f.getName() + " to " + df.getPathname());
					}
					catch (InvalidNameException e) {
						throw new AssertException(e); // unexpected - valid name was used
					}
					catch (IOException e) {
						Msg.showError(JavaFileListHandler.class, tool.getToolFrame(),
							"Packed DB Import Failed", "Failed to import " + f.getName(), e);
					}
				}

			}
A {@link Plugin} that supplies menu items and tasks to import files into Ghidra.
Ghidra/Features/Base/src/main/java/ghidra/plugin/importer/ImporterPlugin.java