|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jalios.util.diff.Diff
public class Diff
The Diff class compares two files. It compares also two BufferedReaders or two strings. after the comparison the vector will represents a list of hunk corresponding with blocks of difference.
| Field Summary | |
|---|---|
static int |
DELETE
|
static int |
INSERT
|
static int |
MAXLINES
|
static int |
ORIGIN
|
| Constructor Summary | |
|---|---|
Diff()
Allocates a new diff containing no Hunks. |
|
Diff(String s1,
String s2)
Allocates a new diff which contains Hunks corresponding
to the difference between the two files passed in arguments. |
|
| Method Summary | |
|---|---|
void |
diffBuffer(BufferedReader in,
BufferedReader inn)
Compares two BufferedReaders and updates the vector of Hunks. |
void |
diffFile(String s1,
String s2)
Compares two files and updates the vector of Hunks. |
void |
diffString(String s1,
String s2)
Compares two strings and updates the vector of Hunks. |
List |
getHunk()
Returns a vector containing Hunks. |
String |
iterateHunkBuffer(BufferedReader reader,
String stuffBeforeDelete,
String stuffAfterDelete,
String stuffBeforeAdd,
String stuffAfterAdd,
String stuffBefore,
String stuffAfter,
boolean printline,
boolean escapeHTML,
boolean hunkString)
Iterate over a the hunks to print a readable representation. |
String |
iterateHunkString(String str,
String stuffBeforeDelete,
String stuffAfterDelete,
String stuffBeforeAdd,
String stuffAfterAdd,
boolean escapeHTML)
Iterate over a the hunks to print a readable representation. |
static void |
main(String[] args)
|
void |
print()
Print Hunks with normal format. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MAXLINES
public static final int ORIGIN
public static final int INSERT
public static final int DELETE
| Constructor Detail |
|---|
public Diff()
diff containing no Hunks.
public Diff(String s1,
String s2)
throws IOException
diff which contains Hunks corresponding
to the difference between the two files passed in arguments.
s1 - first file to compare.s2 - second file to compare.
IOException| Method Detail |
|---|
public static void main(String[] args)
throws Exception
Exception
public String iterateHunkString(String str,
String stuffBeforeDelete,
String stuffAfterDelete,
String stuffBeforeAdd,
String stuffAfterAdd,
boolean escapeHTML)
throws Exception
str - The original string to printstuffBeforeDelete - String to add before deleted hunk.stuffAfterDelete - String to add after deleted hunk.stuffBeforeAdd - String to add before added hunk.stuffAfterAdd - String to add after added hunk.escapeHTML - should escape html ?
Exception
public String iterateHunkBuffer(BufferedReader reader,
String stuffBeforeDelete,
String stuffAfterDelete,
String stuffBeforeAdd,
String stuffAfterAdd,
String stuffBefore,
String stuffAfter,
boolean printline,
boolean escapeHTML,
boolean hunkString)
throws Exception
reader - The original buffer to printstuffBeforeDelete - String to add before deleted hunk.stuffAfterDelete - String to add after deleted hunk.stuffBeforeAdd - String to add before added hunk.stuffAfterAdd - String to add after added hunk.stuffBefore - String to add before line.stuffAfter - String to add after line.printline - should print the line number ?escapeHTML - should escape html ?hunkString - should diff each line of hunks ?
Exceptionpublic List getHunk()
public void diffFile(String s1,
String s2)
throws IOException
s1 - first file to compare.s2 - second file to compare.
IOException
public void diffBuffer(BufferedReader in,
BufferedReader inn)
throws IOException
in - first BufferedReader to compare.inn - second BufferedReader to compare.
IOException
public void diffString(String s1,
String s2)
throws IOException
s1 - first string to compare.s2 - second string to compare.
IOExceptionpublic void print()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||