update
Updates the current checksum with the specified byte.
Parameters
the byte (0..255) to update the checksum with
Updates the current checksum with the specified array of bytes.
This default implementation is equivalent to calling update with the full array.
Parameters
the array of bytes to update the checksum with
Throws
if b is null
Updates the current checksum with a portion of an array of bytes.
Parameters
the byte array to update the checksum with
the start offset of the data
the number of bytes to use for the update
Updates the current checksum with the bytes from the specified buffer.
The checksum is updated with the remaining bytes in the buffer. Upon return, the buffer’s read position will have advanced to its end.
For example, the implementation reads chunks (up to 4096 bytes at a time) from the buffer and updates the checksum:
fun update(buffer: Buffer) {
while (buffer.size > 0L) {
// Process in chunks of up to 4096 bytes.
val chunkSize = min(buffer.size.toInt(), 4096)
val temp = ByteArray(chunkSize)
buffer.read(temp, 0, chunkSize) // advances the buffer's read position
update(temp, 0, chunkSize)
}
}Parameters
the Buffer to update the checksum with
Throws
if buffer is null