本文整理汇总了Java中org.eclipse.jgit.util.RawParseUtils.nextLF方法的典型用法代码示例。如果您正苦于以下问题:Java RawParseUtils.nextLF方法的具体用法?Java RawParseUtils.nextLF怎么用?Java RawParseUtils.nextLF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.util.RawParseUtils
的用法示例。
在下文中一共展示了RawParseUtils.nextLF方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseCanonical
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
void parseCanonical(final RevWalk walk, final byte[] rawTag)
throws CorruptObjectException {
final MutableInteger pos = new MutableInteger();
final int oType;
pos.value = 53; // "object $sha1\ntype "
oType = Constants.decodeTypeString(this, rawTag, (byte) '\n', pos);
walk.idBuffer.fromString(rawTag, 7);
object = walk.lookupAny(walk.idBuffer, oType);
int p = pos.value += 4; // "tag "
final int nameEnd = RawParseUtils.nextLF(rawTag, p) - 1;
tagName = RawParseUtils.decode(UTF_8, rawTag, p, nameEnd);
if (walk.isRetainBody())
buffer = rawTag;
flags |= PARSED;
}
示例2: parseCommentLength
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private static int parseCommentLength(byte[] note, MutableInteger curr, Change.Id changeId)
throws ConfigInvalidException {
checkHeaderLineFormat(note, curr, LENGTH, changeId);
int startOfLength = RawParseUtils.endOfFooterLineKey(note, curr.value) + 1;
MutableInteger i = new MutableInteger();
i.value = startOfLength;
int commentLength = RawParseUtils.parseBase10(note, startOfLength, i);
if (i.value == startOfLength) {
throw parseException(changeId, "could not parse %s", LENGTH);
}
int endOfLine = RawParseUtils.nextLF(note, curr.value);
if (i.value != endOfLine - 1) {
throw parseException(changeId, "could not parse %s", LENGTH);
}
curr.value = endOfLine;
return checkResult(commentLength, "comment length", changeId);
}
示例3: getBytes
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
/** @return a copy of the file's contents. */
public byte[] getBytes() {
byte[] data = read(getPath());
if (isScript(data)) {
// Embed Gerrit's version number into the top of the script.
//
final String version = Version.getVersion();
final int lf = RawParseUtils.nextLF(data, 0);
if (version != null && lf < data.length) {
byte[] versionHeader = Constants.encode("# From Gerrit Code Review " + version + "\n");
ByteArrayOutputStream buf = new ByteArrayOutputStream();
buf.write(data, 0, lf);
buf.write(versionHeader, 0, versionHeader.length);
buf.write(data, lf, data.length - lf);
data = buf.toByteArray();
}
}
return data;
}
示例4: getEmailAddress
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
/**
* Extract the email address (if present) from the footer.
* <p>
* If there is an email address looking string inside of angle brackets
* (e.g. "<[email protected]>"), the return value is the part extracted from inside the
* brackets. If no brackets are found, then {@link #getValue()} is returned
* if the value contains an '@' sign. Otherwise, null.
*
* @return email address appearing in the value of this footer, or null.
*/
public String getEmailAddress() {
final int lt = RawParseUtils.nextLF(buffer, valStart, '<');
if (valEnd <= lt) {
final int at = RawParseUtils.nextLF(buffer, valStart, '@');
if (valStart < at && at < valEnd)
return getValue();
return null;
}
final int gt = RawParseUtils.nextLF(buffer, lt, '>');
if (valEnd < gt)
return null;
return RawParseUtils.decode(enc, buffer, lt, gt - 1);
}
示例5: getFooterLines
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
/**
* Parse the footer lines (e.g. "Signed-off-by") for machine processing.
* <p>
* This method splits all of the footer lines out of the last paragraph of
* the commit message, providing each line as a key-value pair, ordered by
* the order of the line's appearance in the commit message itself.
* <p>
* A footer line's key must match the pattern {@code ^[A-Za-z0-9-]+:}, while
* the value is free-form, but must not contain an LF. Very common keys seen
* in the wild are:
* <ul>
* <li>{@code Signed-off-by} (agrees to Developer Certificate of Origin)
* <li>{@code Acked-by} (thinks change looks sane in context)
* <li>{@code Reported-by} (originally found the issue this change fixes)
* <li>{@code Tested-by} (validated change fixes the issue for them)
* <li>{@code CC}, {@code Cc} (copy on all email related to this change)
* <li>{@code Bug} (link to project's bug tracking system)
* </ul>
*
* @return ordered list of footer lines; empty list if no footers found.
*/
public final List<FooterLine> getFooterLines() {
final byte[] raw = buffer;
int ptr = raw.length - 1;
while (raw[ptr] == '\n') // trim any trailing LFs, not interesting
ptr--;
final int msgB = RawParseUtils.commitMessage(raw, 0);
final ArrayList<FooterLine> r = new ArrayList<>(4);
final Charset enc = guessEncoding();
for (;;) {
ptr = RawParseUtils.prevLF(raw, ptr);
if (ptr <= msgB)
break; // Don't parse commit headers as footer lines.
final int keyStart = ptr + 2;
if (raw[keyStart] == '\n')
break; // Stop at first paragraph break, no footers above it.
final int keyEnd = RawParseUtils.endOfFooterLineKey(raw, keyStart);
if (keyEnd < 0)
continue; // Not a well formed footer line, skip it.
// Skip over the ': *' at the end of the key before the value.
//
int valStart = keyEnd + 1;
while (valStart < raw.length && raw[valStart] == ' ')
valStart++;
// Value ends at the LF, and does not include it.
//
int valEnd = RawParseUtils.nextLF(raw, valStart);
if (raw[valEnd - 1] == '\n')
valEnd--;
r.add(new FooterLine(raw, enc, keyStart, keyEnd, valStart, valEnd));
}
Collections.reverse(r);
return r;
}
示例6: textFor
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
static RawCharSequence textFor(final RevCommit cmit) {
final byte[] raw = cmit.getRawBuffer();
final int b = RawParseUtils.committer(raw, 0);
if (b < 0)
return RawCharSequence.EMPTY;
final int e = RawParseUtils.nextLF(raw, b, '>');
return new RawCharSequence(raw, b, e);
}
示例7: textFor
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
static RawCharSequence textFor(final RevCommit cmit) {
final byte[] raw = cmit.getRawBuffer();
final int b = RawParseUtils.author(raw, 0);
if (b < 0)
return RawCharSequence.EMPTY;
final int e = RawParseUtils.nextLF(raw, b, '>');
return new RawCharSequence(raw, b, e);
}
示例8: parseStringField
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private static String parseStringField(
byte[] note, MutableInteger curr, Change.Id changeId, String fieldName)
throws ConfigInvalidException {
int endOfLine = RawParseUtils.nextLF(note, curr.value);
checkHeaderLineFormat(note, curr, fieldName, changeId);
int startOfField = RawParseUtils.endOfFooterLineKey(note, curr.value) + 2;
curr.value = endOfLine;
return RawParseUtils.decode(UTF_8, note, startOfField, endOfLine - 1);
}
示例9: parsePsId
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private static PatchSet.Id parsePsId(
byte[] note, MutableInteger curr, Change.Id changeId, String fieldName)
throws ConfigInvalidException {
checkHeaderLineFormat(note, curr, fieldName, 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);
}
checkResult(patchSetId, "patchset id", changeId);
curr.value = endOfLine;
return new PatchSet.Id(changeId, patchSetId);
}
示例10: parseParentNumber
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private static Integer parseParentNumber(byte[] note, MutableInteger curr, Change.Id changeId)
throws ConfigInvalidException {
checkHeaderLineFormat(note, curr, PARENT_NUMBER, changeId);
int start = RawParseUtils.endOfFooterLineKey(note, curr.value) + 1;
MutableInteger i = new MutableInteger();
int parentNumber = RawParseUtils.parseBase10(note, start, i);
int endOfLine = RawParseUtils.nextLF(note, curr.value);
if (i.value != endOfLine - 1) {
throw parseException(changeId, "could not parse %s", PARENT_NUMBER);
}
checkResult(parentNumber, "parent number", changeId);
curr.value = endOfLine;
return Integer.valueOf(parentNumber);
}
示例11: parseFilename
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private static String parseFilename(byte[] note, MutableInteger curr, Change.Id changeId)
throws ConfigInvalidException {
checkHeaderLineFormat(note, curr, FILE, changeId);
int startOfFileName = RawParseUtils.endOfFooterLineKey(note, curr.value) + 2;
int endOfLine = RawParseUtils.nextLF(note, curr.value);
curr.value = endOfLine;
curr.value = RawParseUtils.nextLF(note, curr.value);
return QuotedString.GIT_PATH.dequote(
RawParseUtils.decode(UTF_8, note, startOfFileName, endOfLine - 1));
}
示例12: parseTimestamp
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private static Timestamp parseTimestamp(byte[] note, MutableInteger curr, Change.Id changeId)
throws ConfigInvalidException {
int endOfLine = RawParseUtils.nextLF(note, curr.value);
Timestamp commentTime;
String dateString = RawParseUtils.decode(UTF_8, note, curr.value, endOfLine - 1);
try {
commentTime = new Timestamp(GitDateParser.parse(dateString, null, Locale.US).getTime());
} catch (ParseException e) {
throw new ConfigInvalidException("could not parse comment timestamp", e);
}
curr.value = endOfLine;
return checkResult(commentTime, "comment timestamp", changeId);
}
示例13: parseAuthor
import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private Account.Id parseAuthor(
byte[] note, MutableInteger curr, Change.Id changeId, String fieldName)
throws ConfigInvalidException {
checkHeaderLineFormat(note, curr, fieldName, 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, fieldName, changeId);
}