Package org.eclipse.jgit.patch
Class HunkHeader
java.lang.Object
org.eclipse.jgit.patch.HunkHeader
- Direct Known Subclasses:
CombinedHunkHeader
Hunk header describing the layout of a single block of lines
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Details about an old image of the file. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate EditList
(package private) int
Position 1 past the end of this hunk withinfile
's buf.(package private) final FileHeader
(package private) int
Total number of lines of context appearing in this hunk(package private) int
Total number of post-image lines this hunk covers (context + inserted)(package private) int
First line number in the post-image file where the hunk startsprivate final HunkHeader.OldImage
(package private) final int
Offset withinfile
.buf to the "@@ -" line. -
Constructor Summary
ConstructorsConstructorDescriptionHunkHeader
(FileHeader fh, int offset) HunkHeader
(FileHeader fh, int offset, HunkHeader.OldImage oi) HunkHeader
(FileHeader fh, EditList editList) -
Method Summary
Modifier and TypeMethodDescription(package private) void
copyLine
(StringBuilder sb, String[] text, int[] offsets, int fileIdx) (package private) void
extractFileLines
(OutputStream[] out) (package private) void
extractFileLines
(StringBuilder sb, String[] text, int[] offsets) byte[]
Get the byte array holding this hunk's patch script.int
Get offset one past the end of the hunk ingetBuffer()
.Get header for the file this hunk applies to.int
Get total number of lines of context appearing in this hunk.int
Get total number of post-image lines this hunk covers.int
Get first line number in the post-image file where the hunk starts.Get information about the old image mentioned in this hunk.int
Get offset of the start of this hunk ingetBuffer()
.(package private) int
(package private) void
(package private) void
Convert to a list describing the content edits performed within the hunk.toString()
-
Field Details
-
file
-
startOffset
final int startOffsetOffset withinfile
.buf to the "@@ -" line. -
endOffset
int endOffsetPosition 1 past the end of this hunk withinfile
's buf. -
old
-
newStartLine
int newStartLineFirst line number in the post-image file where the hunk starts -
newLineCount
int newLineCountTotal number of post-image lines this hunk covers (context + inserted) -
nContext
int nContextTotal number of lines of context appearing in this hunk -
editList
-
-
Constructor Details
-
HunkHeader
HunkHeader(FileHeader fh, int offset) -
HunkHeader
HunkHeader(FileHeader fh, int offset, HunkHeader.OldImage oi) -
HunkHeader
HunkHeader(FileHeader fh, EditList editList)
-
-
Method Details
-
getFileHeader
Get header for the file this hunk applies to.- Returns:
- header for the file this hunk applies to.
-
getBuffer
public byte[] getBuffer()Get the byte array holding this hunk's patch script.- Returns:
- the byte array holding this hunk's patch script.
-
getStartOffset
public int getStartOffset()Get offset of the start of this hunk ingetBuffer()
.- Returns:
- offset of the start of this hunk in
getBuffer()
.
-
getEndOffset
public int getEndOffset()Get offset one past the end of the hunk ingetBuffer()
.- Returns:
- offset one past the end of the hunk in
getBuffer()
.
-
getOldImage
Get information about the old image mentioned in this hunk.- Returns:
- information about the old image mentioned in this hunk.
-
getNewStartLine
public int getNewStartLine()Get first line number in the post-image file where the hunk starts.- Returns:
- first line number in the post-image file where the hunk starts.
-
getNewLineCount
public int getNewLineCount()Get total number of post-image lines this hunk covers.- Returns:
- total number of post-image lines this hunk covers.
-
getLinesContext
public int getLinesContext()Get total number of lines of context appearing in this hunk.- Returns:
- total number of lines of context appearing in this hunk.
-
toEditList
Convert to a list describing the content edits performed within the hunk.- Returns:
- a list describing the content edits performed within the hunk.
-
parseHeader
void parseHeader() -
parseBody
-
extractFileLines
- Throws:
IOException
-
extractFileLines
-
copyLine
-
skipLine
-
toString
-