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