public void saveAs(BufferFile outFile, boolean associateWithNewFile, TaskMonitor monitor)
			throws IOException, CancelledException {
		synchronized (snapshotLock) {
			synchronized (this) {

				if (corruptedState) {
					throw new IOException("Corrupted BufferMgr state");
				}

				if (outFile.getIndexCount() != 0) {
					throw new IllegalArgumentException("Empty buffer file must be provided");
				}

				if (lockCount != 0) {
					throw new IOException("Attempted saveAs while buffers are locked");
				}

				if (monitor == null) {
					monitor = TaskMonitor.DUMMY;
				}

				int indexCnt = indexProvider.getIndexCount();
				monitor.initialize(indexCnt);

				boolean success = false;
				try {
					doSave(outFile, monitor);
					monitor.setCancelEnabled(false);
					monitor.setMessage("Completing file save...");
					outFile.setReadOnly();
					success = true;
				}
				finally {
					if (!success) {
						outFile.delete();
					}
					monitor.setCancelEnabled(true);
				}
				if (associateWithNewFile) {
					doSetSourceFile(outFile);
				}
			}
		}
	}
Save the current set of buffers to a new buffer file.
@param outFile an empty buffer file open for writing
@param associateWithNewFile if true the outFile will be associated with this BufferMgr as the
current source file, if false no change will be made to this BufferMgr's state and the outFile
will be written and set as read-only.  The caller is responsible for disposing the outFile if
this parameter is false.
@param monitor a cancelable task monitor.  This method will establish the
maximum progress count.
@throws CancelledException if the task monitor canceled the operation.
@throws IOException if source, cache or destination file access error occurs
Ghidra/Framework/DB/src/main/java/db/buffers/BufferMgr.java