Package com.google.gerrit.server.patch
Class SrcContentResolver
java.lang.Object
com.google.gerrit.server.patch.SrcContentResolver
Resolver of the source content of a specific file
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
getSourceContent
(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.lib.ObjectId id, org.eclipse.jgit.lib.FileMode fileMode) Return the source content of a specific file.
-
Method Details
-
getSourceContent
public static byte[] getSourceContent(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.lib.ObjectId id, org.eclipse.jgit.lib.FileMode fileMode) throws IOException Return the source content of a specific file.- Parameters:
repo
- Git repository.id
- Git Object ID of the file blob.fileMode
- File mode of the underlying file as recognized by Git.- Returns:
- byte[] source content of the underlying file if the
id
is of type blob, or a textual representation of the file if it is a git submodule. - Throws:
IOException
- the object ID does not exist in the repository or cannot be accessed.
-