diffFmt.setOldPrefix(sourcePrefix); diffFmt.format(result); diffFmt.flush(); return result;
private String parseDiffEntry(DiffEntry diffEntry) throws StopTaskException { try { mDiffOutput.reset(); mDiffFormatter.format(diffEntry); mDiffFormatter.flush(); String diffText = mDiffOutput.toString("UTF-8"); return diffText; } catch (UnsupportedEncodingException e) { setException(e, R.string.error_diff_failed); throw new StopTaskException(); } catch (IOException e) { setException(e, R.string.error_diff_failed); throw new StopTaskException(); } }
private String parseDiffEntry(DiffEntry diffEntry) throws StopTaskException { try { mDiffOutput.reset(); mDiffFormatter.format(diffEntry); mDiffFormatter.flush(); String diffText = mDiffOutput.toString("UTF-8"); return diffText; } catch (UnsupportedEncodingException e) { setException(e, R.string.error_diff_failed); throw new StopTaskException(); } catch (IOException e) { setException(e, R.string.error_diff_failed); throw new StopTaskException(); } }
/** * Compares the RawText of two files and creates a formateted diff to return. * * @param oldText - RawText. * @param newText - RawText. * @return - Formatted diff in a byte[]. * @throws IOException -failed. */ public byte[] getFormatter(final RawText oldText, final RawText newText) throws IOException { if (!isUndefined()) { val diffAlgorithm = DiffAlgorithm.getAlgorithm( git.getRepository().getConfig().getEnum("diff", null, "algorithm", DiffAlgorithm.SupportedAlgorithm.HISTOGRAM)); val editList = diffAlgorithm.diff(RawTextComparator.DEFAULT, oldText, newText); val bytes = new ByteArrayOutputStream(); try (val df = new DiffFormatter(bytes)) { df.setRepository(git.getRepository()); df.format(editList, oldText, newText); df.flush(); return bytes.toByteArray(); } } return StringUtils.EMPTY.getBytes(StandardCharsets.UTF_8); }
d.append(formatPathLine(path)).append(LF); currentDiff.outputDiff(d, db, diffFmt, true); diffFmt.flush();
private void showDiff(RevCommit c) throws IOException { final RevTree a = c.getParent(0).getTree(); final RevTree b = c.getTree(); if (showNameAndStatusOnly) Diff.nameStatus(outw, diffFmt.scan(a, b)); else { outw.flush(); diffFmt.format(a, b); diffFmt.flush(); } outw.println(); } }
private void showDiff(RevCommit c) throws IOException { final RevTree a = c.getParent(0).getTree(); final RevTree b = c.getTree(); if (showNameAndStatusOnly) Diff.nameStatus(outw, diffFmt.scan(a, b)); else { outw.flush(); diffFmt.format(a, b); diffFmt.flush(); } outw.println(); } }
formatter.flush(); String diff = buffer.toString(); if (diff != null) {
formatter.format(diffEntries); formatter.flush(); return buffer.toString();
formatter.flush(); String diff = buffer.toString(); buffer.reset();
formatter.format(de); formatter.flush(); patch.getManagedPatch().setUnifiedDiff(new String(baos.toByteArray(), "UTF-8"));
formatter.format(de); formatter.flush(); patch.getManagedPatch().setUnifiedDiff(new String(baos.toByteArray(), "UTF-8"));
formatter.format(diffEntries); formatter.flush(); return buffer.toString(); } catch (IOException e) {
diffFmt.setOldPrefix(sourcePrefix); diffFmt.format(result); diffFmt.flush(); return result;
diffFmt.flush();
diffFmt.flush(); return result;
diffFmt.setOldPrefix(sourcePrefix); diffFmt.format(result); diffFmt.flush(); return result;
formatter.flush();
formatter.flush();