/** * Get the differences in git format. * * @param string1 the string1 * @param string2 the string2 * @return the diff * @throws IOException Signals that an I/O exception has occurred. */ private String getDiffinGitFormat(String string1, String string2) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); RawText rt1 = new RawText(string1.getBytes(Charsets.UTF_8)); RawText rt2 = new RawText(string2.getBytes(Charsets.UTF_8)); EditList diffList = new EditList(); diffList.addAll(new HistogramDiff().diff(RawTextComparator.DEFAULT, rt1, rt2)); new DiffFormatter(out).format(diffList, rt1, rt2); return out.toString(Charsets.UTF_8.name()); }
/** * Get the differences in git format. * * @param string1 the string1 * @param string2 the string2 * @return the diff * @throws IOException Signals that an I/O exception has occurred. */ private String getDiffinGitFormat(String string1, String string2) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); RawText rt1 = new RawText(string1.getBytes(Charsets.UTF_8)); RawText rt2 = new RawText(string2.getBytes(Charsets.UTF_8)); EditList diffList = new EditList(); diffList.addAll(new HistogramDiff().diff(RawTextComparator.DEFAULT, rt1, rt2)); new DiffFormatter(out).format(diffList, rt1, rt2); return out.toString(Charsets.UTF_8.name()); }
data2 = new byte[0]; return new HistogramDiff().diff(comparator, // data1.length > 0 ? new RawText(data1) : EMPTY_TEXT, // data2.length > 0 ? new RawText(data2) : EMPTY_TEXT);
data2 = new byte[0]; return new HistogramDiff().diff(comparator, // data1.length > 0 ? new RawText(data1) : EMPTY_TEXT, // data2.length > 0 ? new RawText(data2) : EMPTY_TEXT);