Added in API level 1

Checksum

interface Checksum
java.util.zip.Checksum

An interface representing a data checksum.

Summary

Public methods
abstract Long

Returns the current checksum value.

abstract Unit

Resets the checksum to its initial value.

abstract Unit
update(b: Int)

Updates the current checksum with the specified byte.

open Unit

Updates the current checksum with the specified array of bytes.

abstract Unit
update(b: ByteArray!, off: Int, len: Int)

Updates the current checksum with the specified array of bytes.

open Unit
update(buffer: ByteBuffer!)

Updates the current checksum with the bytes from the specified buffer.

Public methods

getValue

Added in API level 1
abstract fun getValue(): Long

Returns the current checksum value.

Return
Long the current checksum value

reset

Added in API level 1
abstract fun reset(): Unit

Resets the checksum to its initial value.

update

Added in API level 1
abstract fun update(b: Int): Unit

Updates the current checksum with the specified byte.

Parameters
b Int: the byte to update the checksum with

update

Added in API level 34
open fun update(b: ByteArray!): Unit

Updates the current checksum with the specified array of bytes.

Parameters
b ByteArray!: the array of bytes to update the checksum with
Exceptions
java.lang.NullPointerException if b is null

update

Added in API level 1
abstract fun update(
    b: ByteArray!,
    off: Int,
    len: Int
): Unit

Updates the current checksum with the specified array of bytes.

Parameters
b ByteArray!: the byte array to update the checksum with
off Int: the start offset of the data
len Int: the number of bytes to use for the update

update

Added in API level 34
open fun update(buffer: ByteBuffer!): Unit

Updates the current 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!: the ByteBuffer to update the checksum with
Exceptions
java.lang.NullPointerException if buffer is null