aspose file tools*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "File comparison" Watch "File comparison" New topic
Author

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?
Thanks.
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
If you wish to do a check sum, you could use the java.util.zip.CRC32 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.
 
 
subject: File comparison
 
Similar Threads
Question about file comparison
How to make a copy of an object without using Object.clone()?
Comparing 2 XML Files
How to check for the changed file
File structure is detached from SVN repository.