java.util.zip.Checksum
None
None
java.util.zip.Adler32, java.util.zip.CRC32
New as of JDK 1.1
The Checksum interface defines the methods that are needed to compute a checksum value for a stream of data. The checksum value can be used for error checking purposes. Note, however, that the checksum value must fit into a long value, so this interface is not suitable for cryptographic checksum algorithms.
The Adler32 and CRC32 classes implement the Checksum interface, using the Adler-32 and CRC-32 algorithms, respectively. The CheckedInputStream and CheckedOutputStream classes provide a higher-level mechanism for computing checksums on data streams.
public abstract interface java.util.zip.Checksum { // Methods public abstract long getValue(); public abstract void reset(); public abstract void update(int b); public abstract void update(byte[] b, int off, int len); }
The current checksum value.
This method returns the current value of this checksum.
This method resets the checksum to its initial value, making it appear as though it has not been updated by any data.
The value to be added to the data stream for the checksum calculation.
This method adds the specified value to the data stream and updates the checksum value. The method uses only the lowest eight bits of the given int.
An array of bytes to be added to the data stream for the checksum calculation.
An offset into the byte array.
The number of bytes to use.
This method adds len bytes from the specified array, starting at off, to the data stream and updates the checksum value.
Adler32, CheckedInputStream, CheckedOutputStream, CRC32