|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.liferay.util.diff.DiffUtil
com.liferay.portal.kernel.util
.
public class DiffUtil
This class can compare two different versions of a text. Source refers to
the earliest version of the text and target refers to a modified version of
source. Changes are considered either as a removal from the source or as an
addition to the target. This class detects changes to an entire line and also
detects changes within lines, such as, removal or addition of characters.
Take a look at DiffTest
to see the expected inputs and outputs.
Field Summary | |
---|---|
static java.lang.String |
CLOSE_DEL
Deprecated. |
static java.lang.String |
CLOSE_INS
Deprecated. |
static java.lang.String |
CONTEXT_LINE
Deprecated. |
static java.lang.String |
OPEN_DEL
Deprecated. |
static java.lang.String |
OPEN_INS
Deprecated. |
Constructor Summary | |
---|---|
DiffUtil()
Deprecated. |
Method Summary | |
---|---|
static java.util.List<DiffResult>[] |
diff(java.io.Reader source,
java.io.Reader target)
Deprecated. This is a diff method with default values. |
static java.util.List<DiffResult>[] |
diff(java.io.Reader source,
java.io.Reader target,
java.lang.String addedMarkerStart,
java.lang.String addedMarkerEnd,
java.lang.String deletedMarkerStart,
java.lang.String deletedMarkerEnd,
int margin)
Deprecated. The main entrance of this class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String OPEN_INS
public static final java.lang.String CLOSE_INS
public static final java.lang.String OPEN_DEL
public static final java.lang.String CLOSE_DEL
public static final java.lang.String CONTEXT_LINE
Constructor Detail |
---|
public DiffUtil()
Method Detail |
---|
public static java.util.List<DiffResult>[] diff(java.io.Reader source, java.io.Reader target)
source
- the Reader
of the source texttarget
- the Reader
of the target text
DiffResults
,
the first element contains DiffResults related to changes
in source and the second element to changes in targetpublic static java.util.List<DiffResult>[] diff(java.io.Reader source, java.io.Reader target, java.lang.String addedMarkerStart, java.lang.String addedMarkerEnd, java.lang.String deletedMarkerStart, java.lang.String deletedMarkerEnd, int margin)
DiffResults
.
source
- the Reader
of the source text, this can
be for example, an instance of FileReader or StringReadertarget
- the Reader
of the target textaddedMarkerStart
- the initial marker for highlighting
additionsaddedMarkerEnd
- the end marker for highlighting additionsdeletedMarkerStart
- the initial marker for highlighting
removalsdeletedMarkerEnd
- the end marker for highlighting removalsmargin
- the number of lines that will be added before the
first changed line
DiffResults
,
the first element contains DiffResults related to changes
in source and the second element to changes in target
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |