Example usage for org.eclipse.jgit.util RawParseUtils lineMap

List of usage examples for org.eclipse.jgit.util RawParseUtils lineMap

Introduction

In this page you can find the example usage for org.eclipse.jgit.util RawParseUtils lineMap.

Prototype

public static final IntList lineMap(byte[] buf, int ptr, int end) 

Source Link

Document

Index the region between [ptr, end) to find line starts.

Usage

From source file:com.google.gerrit.server.patch.PatchListEntry.java

License:Apache License

public List<String> getHeaderLines() {
    final IntList m = RawParseUtils.lineMap(header, 0, header.length);
    final List<String> headerLines = new ArrayList<>(m.size() - 1);
    for (int i = 1; i < m.size() - 1; i++) {
        final int b = m.get(i);
        int e = m.get(i + 1);
        if (header[e - 1] == '\n') {
            e--;/*from  www .ja v  a  2  s.  c  o m*/
        }
        headerLines.add(RawParseUtils.decode(Constants.CHARSET, header, b, e));
    }
    return headerLines;
}