to top
Android APIs
public class

CRC32

extends Object
implements Checksum
java.lang.Object
   ↳ java.util.zip.CRC32

Class Overview

The CRC32 class is used to compute a CRC32 checksum from data provided as input value. See also Adler32 which is almost as good, but cheaper.

Summary

Public Constructors
CRC32()
Public Methods
long getValue()
Returns the CRC32 checksum for all input received.
void reset()
Resets the CRC32 checksum to it initial state.
void update(byte[] buf, int offset, int byteCount)
Update this CRC32 checksum with the contents of buf, starting from offset and reading byteCount bytes of data.
void update(int val)
Updates this checksum with the byte value provided as integer.
void update(byte[] buf)
Updates this checksum with the bytes contained in buffer buf.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.zip.Checksum

Public Constructors

public CRC32 ()

Since: API Level 1

Public Methods

public long getValue ()

Since: API Level 1

Returns the CRC32 checksum for all input received.

Returns
  • The checksum for this instance.

public void reset ()

Since: API Level 1

Resets the CRC32 checksum to it initial state.

public void update (byte[] buf, int offset, int byteCount)

Since: API Level 1

Update this CRC32 checksum with the contents of buf, starting from offset and reading byteCount bytes of data.

Parameters
buf the byte array from which to read the bytes.
offset the initial position in buf to read the bytes from.
byteCount the number of bytes to read from buf.

public void update (int val)

Since: API Level 1

Updates this checksum with the byte value provided as integer.

Parameters
val represents the byte to update the checksum.

public void update (byte[] buf)

Since: API Level 1

Updates this checksum with the bytes contained in buffer buf.

Parameters
buf the buffer holding the data to update the checksum with.