HashingSink

class HashingSink(hash: HashFunction, sink: SdkSink = SdkSink.blackhole()) : SdkSinkObserver

A sink which hashes data as it is being written to

Parameters

hash

The HashFunction to hash data with

sink

the SdkSink to hash

Constructors

Link copied to clipboard
constructor(hash: HashFunction, sink: SdkSink = SdkSink.blackhole())

Functions

Link copied to clipboard

Provides the digest as a ByteArray

Link copied to clipboard
open override fun observe(data: ByteArray, offset: Int, length: Int)

Callback function invoked with access to the raw data being written. Only data in the range [offset, offset+length) is valid! Do not go out of bounds or mutate the data!

Inherited functions

Link copied to clipboard

Returns a new sink that buffers writes to the sink. Writes will be efficiently "batched". Call SdkSink.flush when done to emit all data to the underlying sink.

Link copied to clipboard
open override fun close()

Pushes all buffered bytes to their final destination and releases resources held by this sink. It is an error to write to a closed sink. This is an idempotent operation.

Link copied to clipboard
open override fun flush()

Pushes all buffered bytes to their final destination

Link copied to clipboard
fun SdkSink.toOkio(): <Error class: unknown class>
Link copied to clipboard
open override fun write(source: SdkBuffer, byteCount: Long)

Removes byteCount bytes from source and appends them to this.