Methods Summary |
---|
public long | getValue()Returns the CRC32 checksum for all input received.
return crc;
|
public void | reset()Resets the CRC32 checksum to it initial state.
tbytes = crc = 0;
|
public void | update(int val)Updates this checksum with the byte value provided as integer.
crc = updateByteImpl((byte) val, crc);
|
public void | update(byte[] buf)Updates this checksum with the bytes contained in buffer {@code buf}.
update(buf, 0, buf.length);
|
public void | update(byte[] buf, int off, int nbytes)Updates this checksum with n bytes of data obtained from buffer {@code
buf}, starting at offset {@code off}.
// avoid int overflow, check null buf
if (off <= buf.length && nbytes >= 0 && off >= 0
&& buf.length - off >= nbytes) {
tbytes += nbytes;
crc = updateImpl(buf, off, nbytes, crc);
} else {
throw new ArrayIndexOutOfBoundsException();
}
|
private native long | updateByteImpl(byte val, long crc1)
|
private native long | updateImpl(byte[] buf, int off, int nbytes, long crc1)
|