File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes File comparison Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "File comparison" Watch "File comparison" New topic

File comparison

Grant Crofton
Ranch Hand

Joined: Nov 08, 2000
Posts: 154
I'm writing an app that has to compare files to previous versions of that file, to see if it's changed. So far, I've read all the files, recording their 'last modified' attribute - to compare the files (as there may be a lot), I first compare this attribute. If it has changed, I need a way to see if the file has changed - I cannot hold a copy of the file to compare them directly (this would be slow anyway), I need to do some kind of checksum. Anyone know anything about this?
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
If you wish to do a check sum, you could use the class. An example:

Hope this helps
[This message has been edited by Carl Trusiak (edited November 09, 2000).]

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Grant Crofton
Ranch Hand

Joined: Nov 08, 2000
Posts: 154
Excellent, thanks.
I agree. Here's the link:
subject: File comparison
jQuery in Action, 3rd edition