|
Java™ by example!
|
|
|
How do I create a checksum of an inputstream?
Use the class CheckedInputStream. This class is a FilterInputStream and calculates a checksum as data passes through it. When creating it, pass it an existing inputstream and an instance of a class that implements the Checksum interface. In the standard API, there are two such classes available: java.util.zip.Adler32 and java.util.zip.CRC32. The checksum value can be retrieved by invoking getChecksum().getValue(). This method calculates the checksum of a file. Main.java:
Further Information
Author of answer: Joris Van den Bogaert
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|