Consider the ex.
Suppose i have a document 1 which is generate over the jsp page when i call it. Now i make some changes in the document 1 and save it. Now when i generate the modified document
i need a way that can highlight the portion that are changed.
As we can do with the help of the compare tools.
In that case you can open streams to the two documents, read them one line at a time and compare the lines.
If you are using Swing, you can use the javax.swing.text.Highlighter to highlight the differences