FileDocCategorySizeDatePackage
CRC32.javaAPI DocJava SE 5 API1523Fri Aug 26 14:57:28 BST 2005java.util.zip

CRC32

public class CRC32 extends Object implements Checksum
A class that can be used to compute the CRC-32 of a data stream.
see
Checksum
version
1.32, 08/09/05
author
David Connelly

Fields Summary
private int
crc
Constructors Summary
public CRC32()
Creates a new CRC32 object.

    
Methods Summary
public longgetValue()
Returns CRC-32 value.

	return (long)crc & 0xffffffffL;
    
public voidreset()
Resets CRC-32 to initial value.

	crc = 0;
    
public voidupdate(int b)
Updates CRC-32 with specified byte.

	crc = update(crc, b);
    
public voidupdate(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 voidupdate(byte[] b)
Updates checksum with specified array of bytes.

param
b the array of bytes to update the checksum with

	crc = updateBytes(crc, b, 0, b.length);
    
private static native intupdate(int crc, int b)

private static native intupdateBytes(int crc, byte[] b, int off, int len)