public class HunkHeader
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
HunkHeader.OldImage
Details about an old image of the file.
|
Modifier and Type | Field and Description |
---|---|
private EditList |
editList |
(package private) int |
endOffset
Position 1 past the end of this hunk within
file 's buf. |
(package private) FileHeader |
file |
(package private) int |
nContext
Total number of lines of context appearing in this hunk
|
(package private) int |
newLineCount
Total number of post-image lines this hunk covers (context + inserted)
|
(package private) int |
newStartLine
First line number in the post-image file where the hunk starts
|
private HunkHeader.OldImage |
old |
(package private) int |
startOffset
Offset within
file .buf to the "@@ -" line. |
Constructor and Description |
---|
HunkHeader(FileHeader fh,
EditList editList) |
HunkHeader(FileHeader fh,
int offset) |
HunkHeader(FileHeader fh,
int offset,
HunkHeader.OldImage oi) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
copyLine(java.lang.StringBuilder sb,
java.lang.String[] text,
int[] offsets,
int fileIdx) |
(package private) void |
extractFileLines(java.io.OutputStream[] out) |
(package private) void |
extractFileLines(java.lang.StringBuilder sb,
java.lang.String[] text,
int[] offsets) |
byte[] |
getBuffer()
Get the byte array holding this hunk's patch script.
|
int |
getEndOffset()
Get offset one past the end of the hunk in
getBuffer() . |
FileHeader |
getFileHeader()
Get header for the file this hunk applies to.
|
int |
getLinesContext()
Get total number of lines of context appearing in this hunk.
|
int |
getNewLineCount()
Get total number of post-image lines this hunk covers.
|
int |
getNewStartLine()
Get first line number in the post-image file where the hunk starts.
|
HunkHeader.OldImage |
getOldImage()
Get information about the old image mentioned in this hunk.
|
int |
getStartOffset()
Get offset of the start of this hunk in
getBuffer() . |
(package private) int |
parseBody(Patch script,
int end) |
(package private) void |
parseHeader() |
(package private) void |
skipLine(java.lang.String[] text,
int[] offsets,
int fileIdx) |
EditList |
toEditList()
Convert to a list describing the content edits performed within the hunk.
|
java.lang.String |
toString() |
final FileHeader file
final int startOffset
file
.buf to the "@@ -" line.int endOffset
file
's buf.private final HunkHeader.OldImage old
int newStartLine
int newLineCount
int nContext
private EditList editList
HunkHeader(FileHeader fh, int offset)
HunkHeader(FileHeader fh, int offset, HunkHeader.OldImage oi)
HunkHeader(FileHeader fh, EditList editList)
public FileHeader getFileHeader()
public byte[] getBuffer()
public int getStartOffset()
getBuffer()
.getBuffer()
.public int getEndOffset()
getBuffer()
.getBuffer()
.public HunkHeader.OldImage getOldImage()
public int getNewStartLine()
public int getNewLineCount()
public int getLinesContext()
public EditList toEditList()
void parseHeader()
int parseBody(Patch script, int end)
void extractFileLines(java.io.OutputStream[] out) throws java.io.IOException
java.io.IOException
void extractFileLines(java.lang.StringBuilder sb, java.lang.String[] text, int[] offsets)
void copyLine(java.lang.StringBuilder sb, java.lang.String[] text, int[] offsets, int fileIdx)
void skipLine(java.lang.String[] text, int[] offsets, int fileIdx)
public java.lang.String toString()
toString
in class java.lang.Object