Top Description Fields Constructors Methods
java.util.zip

public Class Adler32

extends Object
implements Checksum
Class Inheritance
All Implemented Interfaces
java.util.zip.Checksum
Imports
java.nio.ByteBuffer, jdk.internal.util.Preconditions, jdk.internal.vm.annotation.IntrinsicCandidate, sun.nio.ch.DirectBuffer

A 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.

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
Adler32()

Creates a new Adler32 object.

Method Summary

Modifier and TypeMethod and Description
public long
getValue()

Implements java.util.zip.Checksum.getValue.

Returns the checksum value.

public void
reset()

Implements java.util.zip.Checksum.reset.

Resets the checksum to initial value.

public void
update(int
the byte to update the checksum with
b
)

Implements java.util.zip.Checksum.update.

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

public void
update(byte[]
the byte array to update the checksum with
b
,
int
the start offset of the data
off
,
int
the number of bytes to use for the update
len
)

Implements java.util.zip.Checksum.update.

Updates the checksum with the specified array of bytes.

public void
update(ByteBuffer
the ByteBuffer to update the checksum with
buffer
)

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

Updates the checksum with the bytes from the specified buffer.

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

private static native int
updateByteBuffer(int adler, long addr, int off, int len)

private static native int
updateBytes(int adler, byte[] b, int off, int len)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

adlerback to summary
private int adler

Constructor Detail

Adler32back to summary
public Adler32()

Creates a new Adler32 object.

Method Detail

getValueback to summary
public long getValue()

Implements java.util.zip.Checksum.getValue.

Returns the checksum value.

Returns:long

Doc from java.util.zip.Checksum.getValue.

the current checksum value

Annotations
@Override
resetback to summary
public void reset()

Implements java.util.zip.Checksum.reset.

Resets the checksum to initial value.

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

Implements java.util.zip.Checksum.update.

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

Parameters
b:int

Doc from java.util.zip.Checksum.update.

the byte to update the checksum with

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

Implements java.util.zip.Checksum.update.

Updates the checksum with the specified array of bytes.

Parameters
b:byte[]

Doc from java.util.zip.Checksum.update.

the byte array to update the checksum with

off:int

Doc from java.util.zip.Checksum.update.

the start offset of the data

len:int

Doc from java.util.zip.Checksum.update.

the number of bytes to use for the update

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 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.

Parameters
buffer:ByteBuffer

Doc from java.util.zip.Checksum.update.

the ByteBuffer to update the checksum with

Annotations
@Override
Since
1.8
updateback to summary
private static native int update(int adler, int b)
updateByteBufferback to summary
private static native int updateByteBuffer(int adler, long addr, int off, int len)
Annotations
@IntrinsicCandidate
updateBytesback to summary
private static native int updateBytes(int adler, byte[] b, int off, int len)
Annotations
@IntrinsicCandidate