| java.lang.Object com.finalist.util.Diff
Diff | public class Diff (Code) | | This class performs a 'diff' on two files: i.e. compares the two files and returns a result
containing information about the lines that differ.
NOTE: This diff tool does not use the same algorithm as the familiar command-line diff,
so the results will not always be identical.
author: Michael O'Connor - Finalist IT Group. |
Constructor Summary | |
public | Diff(File file1, File file2) Creates a new Diff, given two files that will be compared. |
Method Summary | |
public List | getDiffLines() Performs the diff and returns the result as a List of DiffConflictLine objects. | public static void | main(String[] args) | public String | performDiff() Performs the diff on the two files specified in the constructor, returning a
formatted human-readable report (HTML, in this case). |
Diff | public Diff(File file1, File file2) throws IOException(Code) | | Creates a new Diff, given two files that will be compared.
Parameters: file1 - the first file. Parameters: file2 - the second file. throws: IOException - if either of the files doesn't exist. |
getDiffLines | public List getDiffLines() throws IOException(Code) | | Performs the diff and returns the result as a List of DiffConflictLine objects.
throws: IOException - if the files couldn't be read. |
main | public static void main(String[] args)(Code) | | For testing purposes - I distance off with JUnit, honestly - but it's too slow!
Parameters: args - [1] file#1, [2] file#2. |
performDiff | public String performDiff() throws IOException(Code) | | Performs the diff on the two files specified in the constructor, returning a
formatted human-readable report (HTML, in this case).
a String representation of the diff report, or null if thetwo files were identical (excluding whitespace differences). throws: IOException - if the files couldn't be read. |
|
|