当前位置: 首页>>代码示例>>Java>>正文


Java RawParseUtils.nextLF方法代码示例

本文整理汇总了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;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:19,代码来源:RevTag.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:ChangeNoteUtil.java

示例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;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:ToolsCatalog.java

示例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. "&lt;[email protected]&gt;"), 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);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:24,代码来源:FooterLine.java

示例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;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:61,代码来源:RevCommit.java

示例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);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:9,代码来源:CommitterRevFilter.java

示例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);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:9,代码来源:AuthorRevFilter.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:ChangeNoteUtil.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:16,代码来源:ChangeNoteUtil.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:16,代码来源:ChangeNoteUtil.java

示例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));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:11,代码来源:ChangeNoteUtil.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:14,代码来源:ChangeNoteUtil.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:11,代码来源:ChangeNoteUtil.java


注:本文中的org.eclipse.jgit.util.RawParseUtils.nextLF方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。