public void output(int version, File outputFile, String name, int filetype, String contentType,
			TaskMonitor monitor) throws IOException, CancelledException {
		synchronized (syncObject) {
			if (outputFile.exists()) {
				throw new DuplicateFileException(outputFile.getName() + " already exists");
			}
			if (version == LATEST_VERSION || version == currentVersion) {
				File file = bfMgr.getBufferFile(currentVersion);
				InputStream itemIn = new BufferedInputStream(new FileInputStream(file));
				boolean success = false;
				try {
					ItemSerializer.outputItem(name, contentType, filetype, file.length(), itemIn,
						outputFile, monitor);
					success = true;
				}
				finally {
					try {
						itemIn.close();
					}
					catch (IOException e) {
					}
					if (!success) {
						outputFile.delete();
					}
				}
			}
			else {
				BufferFile bf = openBufferFile(version, -1);
				try {
					File tmpFile =
						Application.createTempFile("ghidra", LocalBufferFile.TEMP_FILE_EXT);
					tmpFile.delete();
					BufferFile tmpBf = new LocalBufferFile(tmpFile, bf.getBufferSize());
					boolean success = false;
					try {
						LocalBufferFile.copyFile(bf, tmpBf, null, monitor);
						tmpBf.close();

						try (InputStream itemIn = new FileInputStream(tmpFile)) {
							ItemSerializer.outputItem(name, contentType, filetype, tmpFile.length(),
								itemIn, outputFile, monitor);
						}
						success = true;
					}
					finally {
						if (!success) {
							outputFile.delete();
						}
						tmpBf.close();
						tmpFile.delete();
					}
				}
				finally {
					bf.close();
				}
			}
		}
	}
Output the current version of this database to a packed storage file.
@param outputFile packed storage file to be written
@param name database name
@param filetype application file type
@param contentType user content type
@param monitor
@throws IOException
@throws CancelledException
Ghidra/Framework/FileSystem/src/main/java/ghidra/framework/store/db/VersionedDatabase.java