synchronized OutputStream getOutputStream(boolean append) throws IOException {
protected OutputStream getOutputStream(boolean append, int appendGeneration) throws IOException { if (outputFile != null) throw new IOException("Output stream is already open"); String name = referenceFile.getName(); File parent = new File(referenceFile.getParent()); File tmpFile = File.createTempFile(name, tmpExt, parent);  if (!append) { OutputStream os = new FileOutputStream(tmpFile); outputFile = tmpFile; return os; }  InputStream is;
	synchronized OutputStream getOutputStream(boolean append) throws IOException {		try {			lock();		} catch (IOException e) {			/* the lock request failed; decrement the use count */			release();			throw e;		}		try {			// always recover file - PAL			//  this way we will never have a invalid file as a .bak file			BufferedInputStream bis = recoverFile();			// Don't forget to close the input stream, we won't need it any more			if (bis != null)				bis.close();		} catch (IOException e) {			if (append) {				unlock();				release();				throw e;			}			// otherwise, go on		}		try {			if (append) {				if (orgFile.exists()) {					int truncate;					if (version == VERSION_2)						truncate = 16;					else						truncate = 0;					cp(orgFile, tmpFile, truncate);				} else {					if (tmpFile.exists())						rm(tmpFile);				}			}			return new FileOutputStream(tmpFile.getPath(), append);		} catch (IOException e) {			unlock();			release();			throw e;		}	}