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


Java ObjectLoader.getBytes方法代码示例

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


在下文中一共展示了ObjectLoader.getBytes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNote

import org.eclipse.jgit.lib.ObjectLoader; //导入方法依赖的package包/类
/**  커밋에 붙어있는 GIT 노트를 가져옴
 * @param commit
 * @return
 */
public String getNote(String commit){
	String str = new String();
	try{
		Note note = git.notesShow().setObjectId(CommitUtils.getCommit(git.getRepository(), commit)).call();
		ObjectLoader loader = this.localRepo.open(note.getData());
		str = new String(loader.getBytes());
	}finally{
		return str;
	}
}
 
开发者ID:forweaver,项目名称:forweaver2.0,代码行数:15,代码来源:GitUtil.java

示例2: getObjectFromRepo

import org.eclipse.jgit.lib.ObjectLoader; //导入方法依赖的package包/类
/**
     *
     * @param repo
     * @param blobId
     * @return
     * @throws LargeObjectException
     * @throws IOException
     */
    public static byte[] getObjectFromRepo(Repository repo, ObjectId blobId) throws LargeObjectException, IOException {
        ObjectReader objectReader = repo.newObjectReader();
        ObjectLoader objectLoader = objectReader.open(blobId);
//        int type = objectLoader.getType(); // Constants.OBJ_BLOB
        byte[] bytes = objectLoader.getBytes();

        return bytes;
    }
 
开发者ID:alexmy21,项目名称:gmds,代码行数:17,代码来源:Commands.java

示例3: makePack

import org.eclipse.jgit.lib.ObjectLoader; //导入方法依赖的package包/类
/**
 * Function used to treat pack object, it load the data from each object of
 * the pack to create the original object when the object is recreate it
 * store the object into the git object index
 *
 * @author Sylvain
 *
 * @param pathPack
 *            the path of the pack file
 * @throws IOException
 * @throws DataFormatException
 */
public static void makePack(String pathPack) throws IOException, DataFormatException {
	String[] path = pathPack.split(osBarre + ".git" + osBarre);
	RepositoryBuilder builder = new RepositoryBuilder();
	builder.setMustExist(true);
	builder.setGitDir(new File(path[0] + osBarre + ".git" + osBarre));
	Repository repository = builder.build();

	for (MutableEntry mutableEntry : new PackFile(new File(pathPack), 0)) {
		GitObject obj = null;
		String sha1 = mutableEntry.toObjectId().name();
		ObjectId id = repository.resolve(sha1);
		ObjectLoader loader = repository.open(id);

		switch (loader.getType()) {
		case Constants.OBJ_BLOB:
			obj = new GitBlob(loader.getSize(), sha1, "", loader.getCachedBytes());
			break;
		case Constants.OBJ_COMMIT:
			obj = new GitCommit(loader.getSize(), sha1, new String(loader.getCachedBytes()));
			break;
		case Constants.OBJ_TREE:
			obj = new GitTree(loader.getSize(), sha1, loader.getBytes());
			break;
		case Constants.OBJ_TAG:
			obj = new GitTag(loader.getSize(), sha1, new String(loader.getCachedBytes()));
			break;
		default:
			break;
		}

		GitObjectsIndex.getInstance().put(mutableEntry.toObjectId().name(), obj);
	}
}
 
开发者ID:VieVie31,项目名称:gitant,代码行数:46,代码来源:MainWindow.java

示例4: getContent

import org.eclipse.jgit.lib.ObjectLoader; //导入方法依赖的package包/类
private String getContent(final ObjectId id) {
  try {
    final ObjectLoader loader = repository.open(id);
    return new String(loader.getBytes());
  }
  catch (final IOException e) {
    return EMPTY;
  }
}
 
开发者ID:sealuzh,项目名称:Permo,代码行数:10,代码来源:JGitDiff.java

示例5: showFileContent

import org.eclipse.jgit.lib.ObjectLoader; //导入方法依赖的package包/类
@Override
public ShowFileContentResponse showFileContent(String file, String version) throws GitException {
  String content;
  ObjectId revision;
  try {
    revision = getRepository().resolve(version);
    try (RevWalk revWalk = new RevWalk(getRepository())) {
      RevCommit revCommit = revWalk.parseCommit(revision);
      RevTree tree = revCommit.getTree();

      try (TreeWalk treeWalk = new TreeWalk(getRepository())) {
        treeWalk.addTree(tree);
        treeWalk.setRecursive(true);
        treeWalk.setFilter(PathFilter.create(file));
        if (!treeWalk.next()) {
          throw new GitException(
              "fatal: Path '" + file + "' does not exist in '" + version + "'" + lineSeparator());
        }
        ObjectId objectId = treeWalk.getObjectId(0);
        ObjectLoader loader = repository.open(objectId);
        content = new String(loader.getBytes());
      }
    }
  } catch (IOException exception) {
    throw new GitException(exception.getMessage());
  }
  return newDto(ShowFileContentResponse.class).withContent(content);
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:JGitConnection.java

示例6: open

import org.eclipse.jgit.lib.ObjectLoader; //导入方法依赖的package包/类
private byte[] open(DiffEntry.Side side, DiffEntry entry)
		throws IOException {
	
	if (entry.getMode(side) == FileMode.MISSING)
		return EMPTY;

	if (entry.getMode(side).getObjectType() != Constants.OBJ_BLOB)
		return EMPTY;

	ObjectLoader ldr = source.open(side, entry);
	return ldr.getBytes(binaryFileThreshold);
}
 
开发者ID:devhub-tud,项目名称:git-server,代码行数:13,代码来源:DiffContextFormatter.java


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