Package org.tmatesoft.svn.core.internal.io.fs

Examples of org.tmatesoft.svn.core.internal.io.fs.CountingOutputStream


        }
    }

    public void displayFileDiff(String path, File file1, File file2,
            String rev1, String rev2, String mimeType1, String mimeType2, OutputStream result) throws SVNException {
        CountingOutputStream counitngStream = new CountingOutputStream(result, 0);
        super.displayFileDiff(path, file1, file2, rev1, rev2, mimeType1, mimeType2, counitngStream);
        if (counitngStream.getPosition() > 0) {
            try {
                result.write(getEOL());
            } catch (IOException e) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage());
                SVNErrorManager.error(err, e, SVNLogType.DEFAULT);
View Full Code Here


                        } else {
                            sourceStream = SVNFileUtil.DUMMY_IN;
                        }
                        targetStream = myRoot.getFileStreamForPath(deltaCombiner, canonicalPath);
                        tmpStream = SVNFileUtil.openFileForWriting(tmpFile);
                        final CountingOutputStream countingStream = new CountingOutputStream(tmpStream, 0)
                        ISVNDeltaConsumer consumer = new ISVNDeltaConsumer() {
                            private boolean isHeaderWritten = false;
                           
                            public OutputStream textDeltaChunk(String path, SVNDiffWindow diffWindow) throws SVNException {
                                try {
                                    if (diffWindow != null) {
                                        diffWindow.writeTo(countingStream, !isHeaderWritten, false);
                                    } else {
                                        SVNDiffWindow.EMPTY.writeTo(countingStream, !isHeaderWritten, false);
                                    }
                                } catch (IOException ioe) {
                                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage());
                                    SVNErrorManager.error(err, ioe, SVNLogType.FSFS);
                                }

                                isHeaderWritten = true;
                                return SVNFileUtil.DUMMY_OUT;
                            }

                            public void applyTextDelta(String path, String baseChecksum) throws SVNException {
                            }
                           
                            public void textDeltaEnd(String path) throws SVNException {
                            }
                        };
                       
                        deltaGenerator.sendDelta(null, sourceStream, 0, targetStream, consumer, false);
                        txtLength = countingStream.getPosition();
                       
                        if (compareRoot != null) {
                            FSRevisionNode revNode = compareRoot.getRevisionNode(comparePath);
                            String hexDigest = revNode.getFileMD5Checksum();
                            if (hexDigest != null && hexDigest.length() > 0) {
View Full Code Here

        }
    }

    public void displayFileDiff(String path, File file1, File file2,
            String rev1, String rev2, String mimeType1, String mimeType2, OutputStream result) throws SVNException {
        CountingOutputStream counitngStream = new CountingOutputStream(result, 0);
        super.displayFileDiff(path, file1, file2, rev1, rev2, mimeType1, mimeType2, counitngStream);
        if (counitngStream.getPosition() > 0) {
            try {
                result.write(getEOL());
            } catch (IOException e) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage());
                SVNErrorManager.error(err, e, SVNLogType.DEFAULT);
            }
        }
        setDiffWritten(counitngStream.getPosition() > 0);
    }
View Full Code Here

                        } else {
                            sourceStream = SVNFileUtil.DUMMY_IN;
                        }
                        targetStream = myRoot.getFileStreamForPath(deltaCombiner, canonicalPath);
                        tmpStream = SVNFileUtil.openFileForWriting(tmpFile);
                        final CountingOutputStream countingStream = new CountingOutputStream(tmpStream, 0)
                        ISVNDeltaConsumer consumer = new ISVNDeltaConsumer() {
                            private boolean isHeaderWritten = false;
                           
                            public OutputStream textDeltaChunk(String path, SVNDiffWindow diffWindow) throws SVNException {
                                try {
                                    if (diffWindow != null) {
                                        diffWindow.writeTo(countingStream, !isHeaderWritten, false);
                                    } else {
                                        SVNDiffWindow.EMPTY.writeTo(countingStream, !isHeaderWritten, false);
                                    }
                                } catch (IOException ioe) {
                                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage());
                                    SVNErrorManager.error(err, ioe, SVNLogType.FSFS);
                                }

                                isHeaderWritten = true;
                                return SVNFileUtil.DUMMY_OUT;
                            }

                            public void applyTextDelta(String path, String baseChecksum) throws SVNException {
                            }
                           
                            public void textDeltaEnd(String path) throws SVNException {
                            }
                        };
                       
                        deltaGenerator.sendDelta(null, sourceStream, 0, targetStream, consumer, false);
                        txtLength = countingStream.getPosition();
                       
                        if (compareRoot != null) {
                            FSRevisionNode revNode = compareRoot.getRevisionNode(comparePath);
                            String hexDigest = revNode.getFileMD5Checksum();
                            if (hexDigest != null && hexDigest.length() > 0) {
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.internal.io.fs.CountingOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.