Class Hunk
java.lang.Object
org.apache.jackrabbit.vault.util.diff.Hunk
A hunk records a block of diff between the left and the right document.
it represents either a insertion, deletion, change or identiy. several
hunks are chained in a linked list.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final inttype indicates a changed blockstatic final inttype indicates a deleted blockstatic final inttype indicates an inserted blockfinal Rangethe range in the left documentfinal Rangethe rnage in the right documentfinal intthe hunk typestatic final inttype indicates an unmodified block -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
UNMODIFIED
public static final int UNMODIFIEDtype indicates an unmodified block- See Also:
-
INSERTED
public static final int INSERTEDtype indicates an inserted block- See Also:
-
DELETED
public static final int DELETEDtype indicates a deleted block- See Also:
-
CHANGED
public static final int CHANGEDtype indicates a changed block- See Also:
-
left
the range in the left document -
right
the rnage in the right document -
type
public final int typethe hunk type
-
-
Constructor Details
-
Hunk
Creates a new hunk and adds it to the previous hunk- Parameters:
left- the left rangeright- the right rangetype- the hunk typeprev- the previous hunk
-
-
Method Details
-
prev
Returns the previous hunk of this chain- Returns:
- the previous hunk.
-
next
Returns the next hunk of this chain- Returns:
- the next hunk.
-
write
Writes a unified diff to the given writer and returns the next hunk to continue the output.- Parameters:
out- the writernumContextLines- the number of context lines to include in the diff blocks. do not change during iteration!- Returns:
- the next hunk or
null. - Throws:
IOException- if an I/O error occurs.
-