Example usage for org.eclipse.jgit.diff RawText writeLine

List of usage examples for org.eclipse.jgit.diff RawText writeLine

Introduction

In this page you can find the example usage for org.eclipse.jgit.diff RawText writeLine.

Prototype

public void writeLine(OutputStream out, int i) throws IOException 

Source Link

Document

Write a specific line to the output stream, without its trailing LF.

Usage

From source file:com.madgag.agit.diff.LineContextDiffer.java

License:Open Source License

private String extractHunk(RawText rawText, int startLine, int endLine) {
    try {//ww w  .  j a va  2 s .  c  om
        ByteArrayOutputStream bas = new ByteArrayOutputStream();
        for (int line = startLine; line < endLine; ++line) {
            rawText.writeLine(bas, line);
            bas.write('\n');
        }
        return new String(bas.toByteArray(), "utf-8");
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}