Package org.apache.jackrabbit.vault.util.diff

Examples of org.apache.jackrabbit.vault.util.diff.DiffWriter


            return;
        }
        try {
            // do the actual diff
            PrintStream s = parent.getContext().getStdout();
            DiffWriter out = new DiffWriter(new OutputStreamWriter(s, Constants.ENCODING));
            out.write("Index: ");
            out.write(getName());
            out.writeNewLine();
            out.write("===================================================================");
            out.writeNewLine();

            Reader r0 = getBaseFile(false) == null ? null : getBaseFile(false).getReader();
            Document d0 = new Document(this, LineElementsFactory.create(this, r0, false));
            Reader r1 = file.exists() ? new InputStreamReader(FileUtils.openInputStream(file), Constants.ENCODING) : null;
            Document d1 = new Document(this, LineElementsFactory.create(this, r1, false));

            DocumentDiff diff;
            try {
                diff = d0.diff(d1);
            } finally {
                IOUtils.closeQuietly(r0);
                IOUtils.closeQuietly(r1);
            }
            diff.write(out, 3);
            out.flush();
        } catch (IOException e) {
            throw exception("Error while writing diff.", e);
        }

    }
View Full Code Here


            }

            // save the diff output
            Writer out = new OutputStreamWriter(FileUtils.openOutputStream(file), Constants.ENCODING);
            try {
                diff.write(new DiffWriter(out), false);
            } catch (IOException e) {
                IOUtils.closeQuietly(out);
            }

            if (diff.hasConflicts()) {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.vault.util.diff.DiffWriter

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.