Class SVNPatchHunk
java.lang.Object
org.tmatesoft.svn.core.internal.wc.patch.SVNPatchHunk
public class SVNPatchHunk
extends java.lang.Object
A single hunk inside a patch.
- Version:
- 1.3
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final java.util.ComparatorCompare function for sorting hunks after parsing.private SVNPatchFileStreamThe hunk's unidiff text as it appeared in the patch file, without range information.private longNumber of lines starting with ' ' before first '+' or '-'.private SVNPatchHunk.SVNPatchHunkRangeprivate static final SVNPatchFileStream.SVNPatchFileLineFilterA stream line-filter which allows only modified text from a hunk, and filters special lines (which start with a backslash).private SVNPatchFileStreamprivate SVNPatchHunk.SVNPatchHunkRangeHunk ranges as they appeared in the patch file.private static final SVNPatchFileStream.SVNPatchFileLineFilterA stream line-filter which allows only original text from a hunk, and filters special lines (which start with a backslash).private SVNPatchFileStreamThe original and modified texts in the hunk range.private static final SVNPatchFileStream.SVNPatchFileLineTransformerLine-transformer callback to shave leading diff symbols.private longNumber of lines starting with ' ' after last '+' or '-'. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()private static chargetChar(java.lang.String line, int i) longlongprivate static booleanparseHunkHeader(java.lang.String header, SVNPatchHunk hunk) Try to parse a hunk header in string HEADER, putting parsed information into HUNK.static SVNPatchHunkparseNextHunk(SVNPatch patch) Return the next HUNK from a PATCH, using STREAM to read data from the patch file.private static java.lang.IntegerparseOffset(java.lang.String number) Try to parse a positive number from a decimal number encoded in the string NUMBER.private static booleanparseRange(SVNPatchHunk.SVNPatchHunkRange hunkRange, java.lang.StringBuffer range) Try to parse a hunk range specification from the string RANGE.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
COMPARATOR
public static final java.util.Comparator COMPARATORCompare 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
public void close() throws java.io.IOException- Throws:
java.io.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:
java.io.IOExceptionSVNException
-
getChar
private static char getChar(java.lang.String line, int i) -
parseHunkHeader
Try to parse a hunk header in string HEADER, putting parsed information into HUNK. Return TRUE if the header parsed correctly. -
parseRange
private static boolean parseRange(SVNPatchHunk.SVNPatchHunkRange hunkRange, java.lang.StringBuffer range) 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
private static java.lang.Integer parseOffset(java.lang.String number) 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.
-