List of usage examples for org.eclipse.jgit.revwalk RevWalk lookupBlob
@NonNull
public RevBlob lookupBlob(AnyObjectId id)
From source file:com.gitblit.utils.JGitUtils.java
License:Apache License
/** * Gets the raw byte content of the specified blob object. * * @param repository/* w ww .ja va2 s.co m*/ * @param objectId * @return byte [] blob content */ public static byte[] getByteContent(Repository repository, String objectId) { RevWalk rw = new RevWalk(repository); byte[] content = null; try { RevBlob blob = rw.lookupBlob(ObjectId.fromString(objectId)); ObjectLoader ldr = repository.open(blob.getId(), Constants.OBJ_BLOB); content = ldr.getCachedBytes(); } catch (Throwable t) { error(t, repository, "{0} can't find blob {1}", objectId); } finally { rw.dispose(); } return content; }