public class FileHeader extends DiffEntry
Modifier and Type | Class and Description |
---|---|
static class |
FileHeader.PatchType
Type of patch used by this file.
|
DiffEntry.ChangeType, DiffEntry.Side
Constructor and Description |
---|
FileHeader(byte[] headerLines,
EditList edits,
FileHeader.PatchType type)
Constructs a new FileHeader
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getBuffer()
Get the byte array holding this file's patch script.
|
int |
getEndOffset()
Get offset one past the end of the file script.
|
BinaryHunk |
getForwardBinaryHunk()
Get the new-image delta/literal if this is a
FileHeader.PatchType.GIT_BINARY . |
List<? extends HunkHeader> |
getHunks()
Get hunks altering this file; in order of appearance in patch
|
FileHeader.PatchType |
getPatchType()
Get style of patch used to modify this file.
|
BinaryHunk |
getReverseBinaryHunk()
Get the old-image delta/literal if this is a
FileHeader.PatchType.GIT_BINARY . |
String |
getScriptText()
Convert the patch script for this file into a string.
|
String |
getScriptText(Charset oldCharset,
Charset newCharset)
Convert the patch script for this file into a string.
|
int |
getStartOffset()
Get offset of the start of this file's script in
getBuffer() . |
boolean |
hasMetaDataChanges()
Whether this patch modifies metadata about a file
|
EditList |
toEditList()
Convert to a list describing the content edits performed on this file.
|
getChangeType, getDiffAttribute, getId, getMode, getNewId, getNewMode, getNewPath, getOldId, getOldMode, getOldPath, getPath, getScore, getTreeFilterMarks, isMarked, scan, scan, scan, toString
public FileHeader(byte[] headerLines, EditList edits, FileHeader.PatchType type)
headerLines
- buffer holding the diff header for this fileedits
- the edits for this filetype
- the type of patch used to modify this filepublic byte[] getBuffer()
public int getStartOffset()
getBuffer()
.getBuffer()
.public int getEndOffset()
public String getScriptText()
The default character encoding
(StandardCharsets.UTF_8
) is assumed for both the
old and new files.
public String getScriptText(Charset oldCharset, Charset newCharset)
oldCharset
- hint character set to decode the old lines with.newCharset
- hint character set to decode the new lines with.public FileHeader.PatchType getPatchType()
public boolean hasMetaDataChanges()
true
if this patch modifies metadata about a file .public List<? extends HunkHeader> getHunks()
public BinaryHunk getForwardBinaryHunk()
FileHeader.PatchType.GIT_BINARY
.FileHeader.PatchType.GIT_BINARY
.public BinaryHunk getReverseBinaryHunk()
FileHeader.PatchType.GIT_BINARY
.FileHeader.PatchType.GIT_BINARY
.public EditList toEditList()
Copyright © 2021 Eclipse JGit Project. All rights reserved.