Java Doc for diff.java in  » Source-Control » sourcejammer » JLibDiff » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Source Control » sourcejammer » JLibDiff 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   JLibDiff.diff

All known Subclasses:   JLibDiff.SJDiff,
diff
public class diff implements define,HunkVisitable(Code)
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.

to generate a file of difference, one can instanciate as follows the class diff:

 diff d = new diff(file1,file2);
 

which is equivalent to:

 diff d = new diff();
 d.diffFile(file1,file2);
 

To compare two BufferedReaders or two String we have to instanciate as follows:

 diff d = new diff();
 d.diffBuffer(BufferedReader1,BufferedReader2);
 

or:

 diff d = new diff();
 d.diffString(String1,String2);
 

The class diff includes methods for examining, printing or saveing blocks of difference: (Hunks). Here are some more examples of how diff can be used:

 diff d=new diff(args[0],args[1]);
 d.print();
 d.save("diff.txt");
 

Example using BufferedReader and ED_format:

 BufferedReader in=new BufferedReader(new FileReader(args[0]));
 BufferedReader inn=new BufferedReader(new FileReader(args[1]));
 diff d = new diff();
 d.diffBuffer(in,inn);
 d.print_ED();
 d.save_ED("diff.txt");
 

To go throw the list of Hunks we can choose between an Enumeration or a loop by spesifyng index in the vector to get at each time the corresponding Hunk.

 Vector v=d.getHunk();
 for(Enumeration e=v.element();e.hasMoreElements(); )
 {
 System.out.print(((Hunk)e.nextElement()).convert());
 }
 

or:

 diff d = new diff(file1,file2);
 for(int i=0; i


See Also:   diff.diff.getHunk
See Also:   diff.diff.hunkAt
See Also:   diff.diff.numberOfHunk
See Also:   diff.diff.print
See Also:   diff.diff.print_ED
See Also:   diff.diff.print_RCS
See Also:   diff.diff.save
See Also:   diff.diff.save_ED
See Also:   diff.diff.save_RCS



Field Summary
 StringmsEOL
    
 Vectorv
    

Constructor Summary
public  diff()
     Allocates a new diff containing no Hunks.
public  diff(diff d)
    
public  diff(Vector v)
    
public  diff(String s1, String s2)
     Allocates a new diff which contains Hunks corresponding to the difference between the two files passed in arguments.
public  diff(String s1, String s2, String algorithmClass)
     Allocates a new diff which contains Hunks corresponding to the difference between the two files passed in arguments.

Method Summary
public  voidaccept(HunkVisitor visitor)
     Accept a visitor in order to visit the collection of hunks.
public  voiddiffBuffer(BufferedReader in, BufferedReader inn)
     Compares two BufferedReaders and updates the vector of Hunks.
public  voiddiffFile(String s1, String s2)
     Compares two files and updates the vector of Hunks.
protected  DiffAlgorithmgetDiffAlgorithmClass()
    
public  VectorgetHunk()
     Returns a vector containing Hunks.
public  VectorgetUnderlyingVector()
    
public  HunkhunkAt(int i)
     Return the hunk at the specified index.
protected  voidmakeDiff(String[] A, String[] B)
    
public  intnumberOfHunk()
     Returns the number of hunks in the vector.
public  voidprint()
     Print Hunks with normal format.
public  voidsetDiffAlgorithmClass(String diffAlgorithmClass)
     Sets the diffAlgorithmClass.
public  voidsupressEndOfLine()
    

Field Detail
msEOL
String msEOL(Code)



v
Vector v(Code)




Constructor Detail
diff
public diff()(Code)
Allocates a new diff containing no Hunks.



diff
public diff(diff d)(Code)



diff
public diff(Vector v)(Code)



diff
public diff(String s1, String s2) throws IOException(Code)
Allocates a new diff which contains Hunks corresponding to the difference between the two files passed in arguments.
Parameters:
  s1 - first file to compare.
Parameters:
  s2 - second file to compare.



diff
public diff(String s1, String s2, String algorithmClass) throws IOException(Code)
Allocates a new diff which contains Hunks corresponding to the difference between the two files passed in arguments.
Parameters:
  s1 - first file to compare.
Parameters:
  s2 - second file to compare.




Method Detail
accept
public void accept(HunkVisitor visitor)(Code)
Accept a visitor in order to visit the collection of hunks.
Parameters:
  visitor - the HunkVisitor.



diffBuffer
public void diffBuffer(BufferedReader in, BufferedReader inn) throws IOException(Code)
Compares two BufferedReaders and updates the vector of Hunks.
Parameters:
  in - first BufferedReader to compare.
Parameters:
  inn - second BufferedReader to compare.



diffFile
public void diffFile(String s1, String s2) throws IOException(Code)
Compares two files and updates the vector of Hunks.
Parameters:
  s1 - first file to compare.
Parameters:
  s2 - second file to compare.



getDiffAlgorithmClass
protected DiffAlgorithm getDiffAlgorithmClass() throws IllegalAccessException, InstantiationException(Code)



getHunk
public Vector getHunk()(Code)
Returns a vector containing Hunks.



getUnderlyingVector
public Vector getUnderlyingVector()(Code)



hunkAt
public Hunk hunkAt(int i)(Code)
Return the hunk at the specified index.
Parameters:
  i - index of the hunk that will be returned.



makeDiff
protected void makeDiff(String[] A, String[] B)(Code)



numberOfHunk
public int numberOfHunk()(Code)
Returns the number of hunks in the vector.



print
public void print()(Code)
Print Hunks with normal format.



setDiffAlgorithmClass
public void setDiffAlgorithmClass(String diffAlgorithmClass)(Code)
Sets the diffAlgorithmClass.
Parameters:
  diffAlgorithmClass - The diffAlgorithmClass to set



supressEndOfLine
public void supressEndOfLine()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.