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


Java RawParseUtils.decode方法代码示例

本文整理汇总了Java中org.eclipse.jgit.util.RawParseUtils.decode方法的典型用法代码示例。如果您正苦于以下问题:Java RawParseUtils.decode方法的具体用法?Java RawParseUtils.decode怎么用?Java RawParseUtils.decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.util.RawParseUtils的用法示例。


在下文中一共展示了RawParseUtils.decode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: run

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
@Override
protected final void run() throws UnloggedFailure {
  try {
    RevisionResource revision =
        revisions.parse(
            changes.parse(TopLevelResource.INSTANCE, IdString.fromUrl(changeId)),
            IdString.fromUrl("current"));
    if (useStdin) {
      ByteBuffer buf = IO.readWholeStream(in, 4096);
      input.rule = RawParseUtils.decode(buf.array(), buf.arrayOffset(), buf.limit());
    }
    Object result = createView().apply(revision, input);
    OutputFormat.JSON.newGson().toJson(result, stdout);
    stdout.print('\n');
  } catch (Exception e) {
    throw die("Processing of prolog script failed: " + e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:19,代码来源:BaseTestPrologCommand.java

示例3: sendMarkdownAsHtml

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private void sendMarkdownAsHtml(
    PluginContentScanner scanner,
    PluginEntry entry,
    String pluginName,
    PluginResourceKey key,
    HttpServletResponse res)
    throws IOException {
  byte[] rawmd = readWholeEntry(scanner, entry);
  String encoding = null;
  Map<Object, String> atts = entry.getAttrs();
  if (atts != null) {
    encoding = Strings.emptyToNull(atts.get(ATTR_CHARACTER_ENCODING));
  }

  String txtmd =
      RawParseUtils.decode(Charset.forName(encoding != null ? encoding : UTF_8.name()), rawmd);
  long time = entry.getTime();
  if (0 < time) {
    res.setDateHeader("Last-Modified", time);
  }
  sendMarkdownAsHtml(txtmd, pluginName, key, res, time);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:HttpPluginServlet.java

示例4: getHtml

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
/**
 * Workaround function for complex private methods in DiffFormatter. This
 * sets the html for the diff headers.
 * 
 * @return
 */
public String getHtml() {
	ByteArrayOutputStream bos = (ByteArrayOutputStream) os;
	String html = RawParseUtils.decode(bos.toByteArray());
	String[] lines = html.split("\n");
	StringBuilder sb = new StringBuilder();
	sb.append("<div class=\"diff\">");
	for (String line : lines) {
		if (line.startsWith("diff")) {
			sb.append("<div class=\"diff header\">").append(StringUtils.convertOctal(line)).append("</div>");
		} else if (line.startsWith("---")) {
			sb.append("<span style=\"color:#800000;\">").append(StringUtils.convertOctal(line)).append("</span><br/>");
		} else if (line.startsWith("+++")) {
			sb.append("<span style=\"color:#008000;\">").append(StringUtils.convertOctal(line)).append("</span><br/>");
		} else {
			sb.append(line).append('\n');
		}
	}
	sb.append("</div>\n");
	return sb.toString();
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:27,代码来源:GitWebDiffFormatter.java

示例5: 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

示例6: readFile

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
public static String readFile(File directory, String fileName)
        throws IOException {
    byte[] content = IO.readFully(new File(directory, fileName));
    // strip off the last LF
    int end = RawParseUtils.prevLF(content, content.length);
    return RawParseUtils.decode(content, 0, end + 1);
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:8,代码来源:RebaseStateUtils.java

示例7: decode

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
@Override
protected String decode(int s, int e) {
  if (charset == null) {
    charset = charset(content, null);
  }
  return RawParseUtils.decode(charset, content, s, e);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:8,代码来源:Text.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: 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

示例10: getPath

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
public synchronized String getPath() {
    if (path == null) {
        path = RawParseUtils.decode(Constants.CHARSET, rawPath);
        rawPath = null; // release memory
    }
    return path;
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:8,代码来源:FilePath.java

示例11: TextBlobView

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
TextBlobView(ObjectLoader objectLoader) throws IOException {
    byte[] cachedBytes = objectLoader.getCachedBytes();
    Log.d(TAG, "Got " + cachedBytes.length + " of data");

    String decode = RawParseUtils.decode(cachedBytes);

    blobHTML = dressFileContentForWebView(decode);
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:9,代码来源:BlobViewFragment.java

示例12: extractTitleFromMarkdown

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
public String extractTitleFromMarkdown(byte[] data, String charEnc) {
  String md = RawParseUtils.decode(Charset.forName(charEnc), data);
  return findTitle(parseMarkdown(md));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:5,代码来源:MarkdownFormatter.java

示例13: readUTF8

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
protected String readUTF8(String fileName) throws IOException {
  byte[] raw = readFile(fileName);
  return raw.length != 0 ? RawParseUtils.decode(raw) : "";
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:5,代码来源:VersionedMetaData.java

示例14: parseChangeMessage

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private void parseChangeMessage(
    PatchSet.Id psId,
    Account.Id accountId,
    Account.Id realAccountId,
    ChangeNotesCommit commit,
    Timestamp ts) {
  byte[] raw = commit.getRawBuffer();
  int size = raw.length;
  Charset enc = RawParseUtils.parseEncoding(raw);

  int subjectStart = RawParseUtils.commitMessage(raw, 0);
  if (subjectStart < 0 || subjectStart >= size) {
    return;
  }

  int subjectEnd = RawParseUtils.endOfParagraph(raw, subjectStart);
  if (subjectEnd == size) {
    return;
  }

  int changeMessageStart;

  if (raw[subjectEnd] == '\n') {
    changeMessageStart = subjectEnd + 2; // \n\n ends paragraph
  } else if (raw[subjectEnd] == '\r') {
    changeMessageStart = subjectEnd + 4; // \r\n\r\n ends paragraph
  } else {
    return;
  }

  int ptr = size - 1;
  int changeMessageEnd = -1;
  while (ptr > changeMessageStart) {
    ptr = RawParseUtils.prevLF(raw, ptr, '\r');
    if (ptr == -1) {
      break;
    }
    if (raw[ptr] == '\n') {
      changeMessageEnd = ptr - 1;
      break;
    } else if (raw[ptr] == '\r') {
      changeMessageEnd = ptr - 3;
      break;
    }
  }

  if (ptr <= changeMessageStart) {
    return;
  }

  String changeMsgString =
      RawParseUtils.decode(enc, raw, changeMessageStart, changeMessageEnd + 1);
  ChangeMessage changeMessage =
      new ChangeMessage(
          new ChangeMessage.Key(psId.getParentKey(), commit.name()), accountId, ts, psId);
  changeMessage.setMessage(changeMsgString);
  changeMessage.setTag(tag);
  changeMessage.setRealAuthor(realAccountId);
  changeMessagesByPatchSet.put(psId, changeMessage);
  allChangeMessages.add(changeMessage);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:62,代码来源:ChangeNotesParser.java

示例15: text

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private String text(RevCommit rev, String path) throws Exception {
  RevObject blob = util.get(rev.getTree(), path);
  byte[] data = db.open(blob).getCachedBytes(Integer.MAX_VALUE);
  return RawParseUtils.decode(data);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:ProjectConfigTest.java


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