![]() |
The Java Developers Almanac 1.4 |
|
e457. Calculating the Checksum of a File try {
// Compute Adler-32 checksum
CheckedInputStream cis = new CheckedInputStream(
new FileInputStream("filename"), new Adler32());
byte[] tempBuf = new byte[128];
while (cis.read(tempBuf) >= 0) {
}
long checksum = cis.getChecksum().getValue();
} catch (IOException e) {
}
© 2002 Addison-Wesley. |