com.judoscript.util.jdiff
Class Diff

java.lang.Object
  extended by com.judoscript.util.jdiff.Diff

public class Diff
extends java.lang.Object


Field Summary
static int DELETE
           
static int INSERT
           
static int MAXLINES
           
static int ORIGIN
           
 
Constructor Summary
Diff()
           
Diff(java.lang.String s1, java.lang.String s2)
          Allocates a new Diff which contains Hunks corresponding to the difference between the two files passed in arguments.
 
Method Summary
 void diffBuffer(java.io.BufferedReader in1, java.io.BufferedReader in2)
          Compares two BufferedReaders and updates the vector of Hunks.
 void diffFile(java.lang.String s1, java.lang.String s2)
           
 void diffString(java.lang.String s1, java.lang.String s2)
           
 Hunk getHunkAt(int i)
           
 java.util.ArrayList getHunks()
           
 int numberOfHunks()
           
 void patchBackFile(java.lang.String currentFile, java.lang.String resultFile)
           
 java.lang.String patchBackText(java.lang.String current)
           
 void patchFile(java.lang.String currentFile, java.lang.String resultFile)
           
 java.lang.String patchText(java.lang.String current)
           
 void print(java.io.PrintWriter pw)
          This will print out the hunks here in a patch file.
static Diff readPatch(java.io.BufferedReader br)
           
static Diff readPatchFile(java.lang.String patchFile)
          This will read in a patch file created by the print() method.
static Diff readPatchText(java.lang.String text)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAXLINES

public static final int MAXLINES
See Also:
Constant Field Values

ORIGIN

public static final int ORIGIN
See Also:
Constant Field Values

INSERT

public static final int INSERT
See Also:
Constant Field Values

DELETE

public static final int DELETE
See Also:
Constant Field Values
Constructor Detail

Diff

public Diff()

Diff

public Diff(java.lang.String s1,
            java.lang.String s2)
     throws java.io.IOException
Allocates a new Diff which contains Hunks corresponding to the difference between the two files passed in arguments.

Parameters:
s1 - first file to compare.
s2 - second file to compare.
Throws:
java.io.IOException
Method Detail

getHunks

public java.util.ArrayList getHunks()

numberOfHunks

public int numberOfHunks()

getHunkAt

public Hunk getHunkAt(int i)

diffFile

public void diffFile(java.lang.String s1,
                     java.lang.String s2)
              throws java.io.IOException
Throws:
java.io.IOException

diffBuffer

public void diffBuffer(java.io.BufferedReader in1,
                       java.io.BufferedReader in2)
                throws java.io.IOException
Compares two BufferedReaders and updates the vector of Hunks.

Parameters:
in1 - first BufferedReader to compare.
in2 - second BufferedReader to compare.
Throws:
java.io.IOException

diffString

public void diffString(java.lang.String s1,
                       java.lang.String s2)
                throws java.io.IOException
Throws:
java.io.IOException

print

public void print(java.io.PrintWriter pw)
This will print out the hunks here in a patch file.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

patchText

public java.lang.String patchText(java.lang.String current)
                           throws java.io.IOException
Throws:
java.io.IOException

patchBackText

public java.lang.String patchBackText(java.lang.String current)
                               throws java.io.IOException
Throws:
java.io.IOException

patchFile

public void patchFile(java.lang.String currentFile,
                      java.lang.String resultFile)
               throws java.io.IOException
Throws:
java.io.IOException

patchBackFile

public void patchBackFile(java.lang.String currentFile,
                          java.lang.String resultFile)
                   throws java.io.IOException
Throws:
java.io.IOException

readPatchFile

public static Diff readPatchFile(java.lang.String patchFile)
                          throws java.io.IOException
This will read in a patch file created by the print() method.

Throws:
java.io.IOException

readPatchText

public static Diff readPatchText(java.lang.String text)
                          throws java.io.IOException
Throws:
java.io.IOException

readPatch

public static Diff readPatch(java.io.BufferedReader br)
                      throws java.io.IOException
Throws:
java.io.IOException