Package ptolemy.util
Class Diff
- java.lang.Object
-
- ptolemy.util.Diff
-
public class Diff extends java.lang.Object
Read two files and compute the diff.This file is based on http://introcs.cs.princeton.edu/96optimization/Diff.java, from 2011, see http://introcs.cs.princeton.edu/96optimization. A current copy may be found at http://introcs.cs.princeton.edu/java/23recursion/Diff.java.html
- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Christopher Brooks
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (cxh)
-
-
Constructor Summary
Constructors Constructor Description Diff()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
diff(java.lang.String aString, java.lang.String bString)
Return the difference between two strings.static void
main(java.lang.String[] args)
Print the difference between two files.
-
-
-
Method Detail
-
diff
public static java.lang.String diff(java.lang.String aString, java.lang.String bString)
Return the difference between two strings.- Parameters:
aString
- The first string to be compared.bString
- The secondString to be compared- Returns:
- A string describing the difference between the two strings in a format similar to the Unix diff command.
-
main
public static void main(java.lang.String[] args) throws java.net.MalformedURLException, java.io.IOException
Print the difference between two files.Usage:
java -classpath $PTII ptolemy.util.test.Diff File1.txt File2.txt
- Parameters:
args
- An array of two elements, where the first element is the filename of the first file and the second element is the filename of the second file.- Throws:
java.net.MalformedURLException
- If a file name cannot be converted into a URL.java.io.IOException
- If a file cannot be read.
-
-