org.bolet.jgz
Class Adler32

java.lang.Object
  extended by org.bolet.jgz.Adler32

public final class Adler32
extends java.lang.Object

This class can be used to compute Adler-32 checksums (specified in RFC 1950 and used in zlib streams).


Constructor Summary
Adler32()
          Create the checksum engine with the standard initial state.
 
Method Summary
 int getSum()
          Get the current checksum value.
 void init()
          Reset the engine to the standard initial state.
 void init(int val)
          Set the current checksum value.
 void update(byte[] buf)
          Update the cheksum with the provided input bytes.
 void update(byte[] buf, int off, int len)
          Update the cheksum with the provided input bytes.
 void update(int v)
          Update the cheksum with the provided input byte.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Adler32

public Adler32()
Create the checksum engine with the standard initial state.

Method Detail

init

public void init()
Reset the engine to the standard initial state.


init

public void init(int val)
Set the current checksum value.

Parameters:
val - the new checksum state

update

public void update(int v)
Update the cheksum with the provided input byte.

Parameters:
v - the input byte (between 0 and 255)

update

public void update(byte[] buf)
Update the cheksum with the provided input bytes.

Parameters:
buf - the data buffer

update

public void update(byte[] buf,
                   int off,
                   int len)
Update the cheksum with the provided input bytes.

Parameters:
buf - the data buffer
off - the data offset
len - the data length (in bytes)

getSum

public int getSum()
Get the current checksum value. This does not invalidate the state.

Returns:
the current checksum