APIdia Launch Partner
Top Description Fields Constructors Methods
java.util.zip

public Class CRC32

extends Object
implements Checksum
Class Inheritance
All Implemented Interfaces
java.util.zip.Checksum
Known Direct Subclasses
sun.util.calendar.ZoneInfoFile.Checksum
Imports
java.nio.ByteBuffer, java.util.Objects, jdk.internal.util.Preconditions, jdk.internal.vm.annotation.IntrinsicCandidate

A class that can be used to compute the CRC-32 of a data stream.

Passing a null argument to a method in this class will cause a NullPointerException to be thrown.

Author
David Connelly
Since
1.1

Field Summary

Modifier and TypeField and Description
private int

Constructor Summary

AccessConstructor and Description
public
CRC32()

Creates a new CRC32 object.

Method Summary

Modifier and TypeMethod and Description
public long
getValue()

Implements java.util.zip.Checksum.getValue.

Returns CRC-32 value.

public void
reset()

Implements java.util.zip.Checksum.reset.

Resets CRC-32 to initial value.

public void
update(int b)

Implements java.util.zip.Checksum.update.

Updates the CRC-32 checksum with the specified byte (the low eight bits of the argument b).

public void
update(byte[] b, int off, int len)

Implements java.util.zip.Checksum.update.

Updates the CRC-32 checksum with the specified array of bytes.

public void
update(ByteBuffer buffer)

Overrides default java.util.zip.Checksum.update.

Updates the CRC-32 checksum with the bytes from the specified buffer.

private static native int
update(int crc, int b)

private static int
updateByteBuffer(int alder, long addr, int off, int len)

private static native int
updateByteBuffer0(int alder, long addr, int off, int len)

private static void
private static int
updateBytes(int crc, byte[] b, int off, int len)

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

private static void
updateBytesCheck(byte[] b, int off, int len)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

crcback to summary
private int crc

Constructor Detail

CRC32back to summary
public CRC32()

Creates a new CRC32 object.

Method Detail

getValueback to summary
public long getValue()

Implements java.util.zip.Checksum.getValue.

Returns CRC-32 value.

Annotations
@Override
resetback to summary
public void reset()

Implements java.util.zip.Checksum.reset.

Resets CRC-32 to initial value.

Annotations
@Override
updateback to summary
public void update(int b)

Implements java.util.zip.Checksum.update.

Updates the CRC-32 checksum with the specified byte (the low eight bits of the argument b).

Annotations
@Override
updateback to summary
public void update(byte[] b, int off, int len)

Implements java.util.zip.Checksum.update.

Updates the CRC-32 checksum with the specified array of bytes.

Annotations
@Override
Exceptions
ArrayIndexOutOfBoundsException:
if off is negative, or len is negative, or off+len is negative or greater than the length of the array b.
updateback to summary
public void update(ByteBuffer buffer)

Overrides default java.util.zip.Checksum.update.

Updates the CRC-32 checksum with the bytes from the specified buffer. The checksum is updated with the remaining bytes in the buffer, starting at the buffer's position. Upon return, the buffer's position will be updated to its limit; its limit will not have been changed.

Annotations
@Override
Since
1.8
updateback to summary
private static native int update(int crc, int b)
Annotations
@IntrinsicCandidate
updateByteBufferback to summary
private static int updateByteBuffer(int alder, long addr, int off, int len)
updateByteBuffer0back to summary
private static native int updateByteBuffer0(int alder, long addr, int off, int len)
Annotations
@IntrinsicCandidate
updateByteBufferCheckback to summary
private static void updateByteBufferCheck(long addr)
updateBytesback to summary
private static int updateBytes(int crc, byte[] b, int off, int len)
updateBytes0back to summary
private static native int updateBytes0(int crc, byte[] b, int off, int len)
Annotations
@IntrinsicCandidate
updateBytesCheckback to summary
private static void updateBytesCheck(byte[] b, int off, int len)