*
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 Android Security Essentials Live Lessons this week in the Android 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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File comparison
 
Similar Threads
Question about file comparison
File structure is detached from SVN repository.
Comparing 2 XML Files
How to check for the changed file
How to make a copy of an object without using Object.clone()?