class BufferMgr {

	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 = TaskMonitorAdapter.DUMMY_MONITOR;
				}

				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) {
					setSourceFile(outFile);
				}
			}
		}
	}

	public  BufferMgr();
	public  BufferMgr(int requestedBufferSize, long approxCacheSize, int maxUndos);
	public  BufferMgr(BufferFile sourceFile);
	public  BufferMgr(BufferFile sourceFile, long approxCacheSize, int maxUndos);
	private  BufferMgr(BufferFile sourceFile, int requestedbufferSize, long approxCacheSize,
			int maxUndos);

}