Adler32public class Adler32 extends Object implements ChecksumA class that can be used to compute the Adler-32 checksum of a data
stream. An Adler-32 checksum is almost as reliable as a CRC-32 but
can be computed much faster. |
Fields Summary |
---|
private int | adler |
Constructors Summary |
---|
public Adler32()Creates a new Adler32 object.
|
Methods Summary |
---|
public long | getValue()Returns checksum value.
return (long)adler & 0xffffffffL;
| public void | reset()Resets checksum to initial value.
adler = 1;
| public void | update(int b)Updates checksum with specified byte.
adler = update(adler, b);
| public void | update(byte[] b, int off, int len)Updates checksum with specified array of bytes.
if (b == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off > b.length - len) {
throw new ArrayIndexOutOfBoundsException();
}
adler = updateBytes(adler, b, off, len);
| public void | update(byte[] b)Updates checksum with specified array of bytes.
adler = updateBytes(adler, b, 0, b.length);
| private static native int | update(int adler, int b)
| private static native int | updateBytes(int adler, byte[] b, int off, int len)
|
|