public class DocumentDiff
extends java.lang.Object
ChangeListener
which is called for each line of the document, or
using the Hunk
s that form the differences of this diff.Constructor and Description |
---|
DocumentDiff(Document left,
Document right)
Create a new diff from the given 2 documents
|
Modifier and Type | Method and Description |
---|---|
Hunk |
getHunks()
Returns the linked list of hunks
|
ElementsFactory |
getMergedLeft()
Returns an element factory that provides the elements of the merged
result of this diff where the left document is dominant.
|
ElementsFactory |
getMergedRight()
Returns an element factory that provides the elements of the merged
result of this diff where the right document is dominant.
|
int |
getNumDeltaElements()
Returns the number of changed elements.
|
void |
showChanges(ChangeListener listener,
int numContextLines)
Iterate over all changes and invoke the respective methods in the given
listener.
|
void |
write(DiffWriter out,
int numContextLines)
Writes the differences to the given writer in a unified diff
format.
|
void |
write(java.lang.StringBuffer buf,
int numContextLines)
Same as
write(Writer, int) but to a string buffer. |
void |
write(java.lang.StringBuffer buf,
java.lang.String lineSeparator,
int numContextLines)
Same as
write(DiffWriter, int) but to a string buffer. |
void |
write(java.io.Writer out,
int numContextLines)
Same as
write(DiffWriter, int) but wraps the given writer
with a default diff writer. |
public int getNumDeltaElements()
public Hunk getHunks()
public void write(java.lang.StringBuffer buf, int numContextLines)
write(Writer, int)
but to a string buffer.buf
- the buffernumContextLines
- the number of context lines.public void write(java.lang.StringBuffer buf, java.lang.String lineSeparator, int numContextLines)
write(DiffWriter, int)
but to a string buffer.buf
- the bufferlineSeparator
- the line separator to usenumContextLines
- the number of context lines.public void write(java.io.Writer out, int numContextLines) throws java.io.IOException
write(DiffWriter, int)
but wraps the given writer
with a default diff writer.out
- the writernumContextLines
- the number of context lines.java.io.IOException
- if an I/O error occurspublic void write(DiffWriter out, int numContextLines) throws java.io.IOException
out
- the writernumContextLines
- the number of context lines.java.io.IOException
- if an I/O error occurspublic void showChanges(ChangeListener listener, int numContextLines)
listener
- the change listenernumContextLines
- the number of context linespublic ElementsFactory getMergedLeft()
public ElementsFactory getMergedRight()
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"