private GFileSystem mountUsingFactory(FileSystemInfoRec fsir, ByteProvider byteProvider,
			FSRLRoot targetFSRL, FileSystemService fsService, TaskMonitor monitor)
			throws IOException, CancelledException {

		GFileSystem result = null;
		boolean bpTaken = false;
		try {
			GFileSystemFactory<?> factory = fsir.getFactory();
			if (factory instanceof GFileSystemFactoryByteProvider) {
				GFileSystemFactoryByteProvider<?> bpFactory =
					(GFileSystemFactoryByteProvider<?>) factory;
				bpTaken = true;
				result = bpFactory.create(targetFSRL, byteProvider, fsService, monitor);
			}
			// add additional GFileSystemFactoryXYZ support blocks here
		}
		catch (IOException | CancelledException e) {
			Msg.warn(this,
				"Error during fs factory create: " + fsir.getType() + ", " + fsir.getFSClass(), e);
			throw e;
		}
		finally {
			if (byteProvider != null && !bpTaken) {
				byteProvider.close();
			}
		}

		return result;
	}
Creates a new {@link GFileSystem} instance when the filesystem type is already
known, consuming the specified ByteProvider.

@param fsType filesystem type string, ie. "file", "zip".
@param byteProvider {@link ByteProvider}, will be owned by the new file system
@param fsService reference to the {@link FileSystemService} instance.
@param monitor {@link TaskMonitor} to use for canceling and updating progress.
@return new {@link GFileSystem} instance.
@throws IOException if error when opening the filesystem or unknown fsType.
@throws CancelledException if the user canceled the operation.
Ghidra/Features/Base/src/main/java/ghidra/formats/gfilesystem/factory/FileSystemFactoryMgr.java