BufferedChecksum

class BufferedChecksum @JvmOverloads constructor(in: Checksum, bufferSize: Int = DEFAULT_BUFFERSIZE) : Checksum

Wraps another Checksum with an internal buffer to speed up checksum calculations.

Constructors

Link copied to clipboard
constructor(in: Checksum, bufferSize: Int = DEFAULT_BUFFERSIZE)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun getValue(): Long

Returns the current checksum value.

Link copied to clipboard
open override fun reset()

Resets the checksum to its initial value.

Link copied to clipboard
open fun update(b: ByteArray)

Updates the current checksum with the specified array of bytes.

open fun update(buffer: Buffer)

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

open fun update(byteBuffer: ByteBuffer)

open override fun update(b: Int)

Create a new BufferedChecksum with the specified bufferSize

open override fun update(b: ByteArray, off: Int, len: Int)

Updates the current checksum with a portion of an array of bytes.

Link copied to clipboard
fun updateInt(value: Int)

Writes value as a little-endian int into buffer at the current offset.

Link copied to clipboard
fun updateLong(value: Long)

Writes value as a little‑endian long into the internal buffer. Flushes if there isn’t enough room.

Link copied to clipboard
fun updateLongs(vals: LongArray, offset: Int, len: Int)

Updates the checksum by writing multiple long values from vals starting at offset for len entries. It writes as many longs as possible into the internal buffer (which is backed by a ByteArray) in little‑endian order. When there isn’t enough space, flush is called.

Link copied to clipboard
fun updateShort(value: Short)

Writes value as a little-endian short into buffer at the current offset.