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

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

Introduction

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

Prototype

public static int endOfFooterLineKey(byte[] raw, int ptr) 

Source Link

Document

Locate the end of a footer line key string.

Usage

From source file:com.google.gerrit.server.notedb.CommentsInNotesUtil.java

License:Apache License

private static String parseStringField(byte[] note, MutableInteger curr, Change.Id changeId, Charset enc,
        String fieldName) throws ConfigInvalidException {
    int endOfLine = RawParseUtils.nextLF(note, curr.value);
    checkHeaderLineFormat(note, curr, fieldName, enc, changeId);
    int startOfField = RawParseUtils.endOfFooterLineKey(note, curr.value) + 2;
    curr.value = endOfLine;//from www . j av a 2  s.c  om
    return RawParseUtils.decode(enc, note, startOfField, endOfLine - 1);
}

From source file:com.google.gerrit.server.notedb.CommentsInNotesUtil.java

License:Apache License

private static PatchSet.Id parsePsId(byte[] note, MutableInteger curr, Change.Id changeId, Charset enc,
        String fieldName) throws ConfigInvalidException {
    checkHeaderLineFormat(note, curr, fieldName, enc, changeId);
    int startOfPsId = RawParseUtils.endOfFooterLineKey(note, curr.value) + 1;
    MutableInteger i = new MutableInteger();
    int patchSetId = RawParseUtils.parseBase10(note, startOfPsId, i);
    int endOfLine = RawParseUtils.nextLF(note, curr.value);
    if (i.value != endOfLine - 1) {
        throw parseException(changeId, "could not parse %s", fieldName);
    }//from  w  ww .  j  av  a2  s  .com
    checkResult(patchSetId, "patchset id", changeId);
    curr.value = endOfLine;
    return new PatchSet.Id(changeId, patchSetId);
}

From source file:com.google.gerrit.server.notedb.CommentsInNotesUtil.java

License:Apache License

private static String parseFilename(byte[] note, MutableInteger curr, Change.Id changeId, Charset enc)
        throws ConfigInvalidException {
    checkHeaderLineFormat(note, curr, FILE, enc, changeId);
    int startOfFileName = RawParseUtils.endOfFooterLineKey(note, curr.value) + 2;
    int endOfLine = RawParseUtils.nextLF(note, curr.value);
    curr.value = endOfLine;//w  w w .ja va2 s .c o m
    curr.value = RawParseUtils.nextLF(note, curr.value);
    return QuotedString.GIT_PATH.dequote(RawParseUtils.decode(enc, note, startOfFileName, endOfLine - 1));
}

From source file:com.google.gerrit.server.notedb.CommentsInNotesUtil.java

License:Apache License

private static Account.Id parseAuthor(byte[] note, MutableInteger curr, Change.Id changeId, Charset enc)
        throws ConfigInvalidException {
    checkHeaderLineFormat(note, curr, AUTHOR, enc, changeId);
    int startOfAccountId = RawParseUtils.endOfFooterLineKey(note, curr.value) + 2;
    PersonIdent ident = RawParseUtils.parsePersonIdent(note, startOfAccountId);
    Account.Id aId = parseIdent(ident, changeId);
    curr.value = RawParseUtils.nextLF(note, curr.value);
    return checkResult(aId, "comment author", changeId);
}

From source file:com.google.gerrit.server.notedb.CommentsInNotesUtil.java

License:Apache License

private static int parseCommentLength(byte[] note, MutableInteger curr, Change.Id changeId, Charset enc)
        throws ConfigInvalidException {
    checkHeaderLineFormat(note, curr, LENGTH, enc, changeId);
    int startOfLength = RawParseUtils.endOfFooterLineKey(note, curr.value) + 1;
    MutableInteger i = new MutableInteger();
    int commentLength = RawParseUtils.parseBase10(note, startOfLength, i);
    int endOfLine = RawParseUtils.nextLF(note, curr.value);
    if (i.value != endOfLine - 1) {
        throw parseException(changeId, "could not parse %s", PATCH_SET);
    }/*w w w. ja  v  a 2s. c  o m*/
    curr.value = endOfLine;
    return checkResult(commentLength, "comment length", changeId);
}