Class SVNPatchHunk
java.lang.Object
org.tmatesoft.svn.core.internal.wc.patch.SVNPatchHunk
A single hunk inside a patch.
- Version:
- 1.3
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator
Compare function for sorting hunks after parsing.private SVNPatchFileStream
The hunk's unidiff text as it appeared in the patch file, without range information.private long
Number of lines starting with ' ' before first '+' or '-'.private SVNPatchHunk.SVNPatchHunkRange
private static final SVNPatchFileStream.SVNPatchFileLineFilter
A stream line-filter which allows only modified text from a hunk, and filters special lines (which start with a backslash).private SVNPatchFileStream
private SVNPatchHunk.SVNPatchHunkRange
Hunk ranges as they appeared in the patch file.private static final SVNPatchFileStream.SVNPatchFileLineFilter
A stream line-filter which allows only original text from a hunk, and filters special lines (which start with a backslash).private SVNPatchFileStream
The original and modified texts in the hunk range.private static final SVNPatchFileStream.SVNPatchFileLineTransformer
Line-transformer callback to shave leading diff symbols.private long
Number of lines starting with ' ' after last '+' or '-'. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
private static char
long
long
private static boolean
parseHunkHeader
(String header, SVNPatchHunk hunk) Try to parse a hunk header in string HEADER, putting parsed information into HUNK.static SVNPatchHunk
parseNextHunk
(SVNPatch patch) Return the next HUNK from a PATCH, using STREAM to read data from the patch file.private static Integer
parseOffset
(String number) Try to parse a positive number from a decimal number encoded in the string NUMBER.private static boolean
parseRange
(SVNPatchHunk.SVNPatchHunkRange hunkRange, StringBuffer range) Try to parse a hunk range specification from the string RANGE.
-
Field Details
-
COMPARATOR
Compare function for sorting hunks after parsing. We sort hunks by their original line offset. -
original_line_filter
A stream line-filter which allows only original text from a hunk, and filters special lines (which start with a backslash). -
modified_line_filter
A stream line-filter which allows only modified text from a hunk, and filters special lines (which start with a backslash). -
remove_leading_char_transformer
Line-transformer callback to shave leading diff symbols. -
diffText
The hunk's unidiff text as it appeared in the patch file, without range information. -
originalText
The original and modified texts in the hunk range. Derived from the diff text. For example, consider a hunk such as: -
modifiedText
-
original
Hunk ranges as they appeared in the patch file. All numbers are lines, not bytes. -
modified
-
leadingContext
private long leadingContextNumber of lines starting with ' ' before first '+' or '-'. -
trailingContext
private long trailingContextNumber of lines starting with ' ' after last '+' or '-'.
-
-
Constructor Details
-
SVNPatchHunk
public SVNPatchHunk()
-
-
Method Details
-
getDiffText
-
getOriginalText
-
getModifiedText
-
getOriginal
-
getModified
-
getLeadingContext
public long getLeadingContext() -
getTrailingContext
public long getTrailingContext() -
close
- Throws:
IOException
-
parseNextHunk
Return the next HUNK from a PATCH, using STREAM to read data from the patch file. If no hunk can be found, set HUNK to NULL.- Throws:
IOException
SVNException
-
getChar
-
parseHunkHeader
Try to parse a hunk header in string HEADER, putting parsed information into HUNK. Return TRUE if the header parsed correctly. -
parseRange
Try to parse a hunk range specification from the string RANGE. Return parsed information in START and LENGTH, and return TRUE if the range parsed correctly. Note: This function may modify the input value RANGE. -
parseOffset
Try to parse a positive number from a decimal number encoded in the string NUMBER. Return parsed number in OFFSET, and return TRUE if parsing was successful.
-