public static OutputStream createStream(FSRevisionNode revNode, FSTransactionRoot txnRoot, FSOutputStream dstStream) throws SVNException {
public static OutputStream createStream(FSRevisionNode revNode, FSTransactionRoot txnRoot, OutputStream dstStream) throws SVNException {
    public static OutputStream createStream(FSRevisionNode revNode, FSTransactionRoot txnRoot, FSOutputStream dstStream) throws SVNException {        if(revNode.getType() != SVNNodeKind.FILE){            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FILE, "Attempted to set textual contents of a *non*-file node");            SVNErrorManager.error(err);        }        if(!revNode.getId().isTxn()){            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_MUTABLE, "Attempted to set textual contents of an immutable node");            SVNErrorManager.error(err);        }                OutputStream targetOS = null;        InputStream sourceStream = null;        long offset = -1;        long deltaStart = -1;        try {            File targetFile = txnRoot.getTransactionRevFile();             offset = targetFile.length();            targetOS = SVNFileUtil.openFileForWriting(targetFile, true);            CountingStream revWriter = new CountingStream(targetOS, offset);                        FSRepresentation baseRep = revNode.chooseDeltaBase(txnRoot.getOwner());            sourceStream = FSInputStream.createDeltaStream(new SVNDeltaCombiner(), baseRep, txnRoot.getOwner());            String header;                        if(baseRep != null){                header = FSRepresentation.REP_DELTA + " " + baseRep.getRevision() + " " + baseRep.getOffset() + " " + baseRep.getSize() + "\n";             }else{                header = FSRepresentation.REP_DELTA + "\n";            }            revWriter.write(header.getBytes("UTF-8"));            deltaStart = revWriter.getPosition();                        if(dstStream == null){                return new FSOutputStream(revNode, revWriter, sourceStream, deltaStart, 0, offset, txnRoot);            }            dstStream.reset(revNode, revWriter, sourceStream, deltaStart, 0, offset, txnRoot);            return dstStream;        } catch(IOException ioe) {            SVNFileUtil.closeFile(targetOS);            SVNFileUtil.closeFile(sourceStream);            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage());            SVNErrorManager.error(err, ioe);        } catch(SVNException svne) {            SVNFileUtil.closeFile(targetOS);            SVNFileUtil.closeFile(sourceStream);            throw svne;        }        return null;    }