Package com.google.gerrit.server.change
Class FileContentUtil
- java.lang.Object
-
- com.google.gerrit.server.change.FileContentUtil
-
public class FileContentUtil extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
TEXT_X_GERRIT_COMMIT_MESSAGE
static String
TEXT_X_GERRIT_MERGE_LIST
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BinaryResult
downloadContent(ProjectState project, org.eclipse.jgit.lib.ObjectId revstr, String path, Integer parent)
BinaryResult
getContent(ProjectState project, org.eclipse.jgit.lib.ObjectId revstr, String path, Integer parent)
Get the content of a file at a specific commit or one of it's parent commits.BinaryResult
getContent(org.eclipse.jgit.lib.Repository repo, ProjectState project, org.eclipse.jgit.lib.ObjectId revstr, String path)
static String
resolveContentType(ProjectState project, String path, PatchScript.FileMode fileMode, String mimeType)
-
-
-
Field Detail
-
TEXT_X_GERRIT_COMMIT_MESSAGE
public static final String TEXT_X_GERRIT_COMMIT_MESSAGE
- See Also:
- Constant Field Values
-
TEXT_X_GERRIT_MERGE_LIST
public static final String TEXT_X_GERRIT_MERGE_LIST
- See Also:
- Constant Field Values
-
-
Method Detail
-
getContent
public BinaryResult getContent(ProjectState project, org.eclipse.jgit.lib.ObjectId revstr, String path, Integer parent) throws BadRequestException, ResourceNotFoundException, IOException
Get the content of a file at a specific commit or one of it's parent commits.- Parameters:
project
- AProject
that this request refers to.revstr
- AnObjectId
specifying the commit.path
- A string specifying the filepath.parent
- A 1-based parent index to get the content from instead. Null if the content should be obtained fromrevstr
instead.- Returns:
- Content of the file as
BinaryResult
. - Throws:
BadRequestException
ResourceNotFoundException
IOException
-
getContent
public BinaryResult getContent(org.eclipse.jgit.lib.Repository repo, ProjectState project, org.eclipse.jgit.lib.ObjectId revstr, String path) throws IOException, ResourceNotFoundException, BadRequestException
-
downloadContent
public BinaryResult downloadContent(ProjectState project, org.eclipse.jgit.lib.ObjectId revstr, String path, Integer parent) throws ResourceNotFoundException, IOException
- Throws:
ResourceNotFoundException
IOException
-
resolveContentType
public static String resolveContentType(ProjectState project, String path, PatchScript.FileMode fileMode, String mimeType)
-
-