readFully

suspend fun SdkByteReadChannel.readFully(sink: SdkBuffer, byteCount: Long)

Read exactly byteCount bytes from this into sink or throws EOFException if the channel is exhausted before all bytes could be read.

A failed channel will throw whatever exception the channel was closed with.

Parameters

sink

the buffer that data read from the channel will be appended to

byteCount

the number of bytes to read from the channel


fun SdkSource.readFully(sink: SdkBuffer, byteCount: Long)

Remove exactly byteCount bytes from this source and appends them to sink.

Parameters

sink

The sink to append bytes to

byteCount

the number of bytes to read from the source

Throws

when byteCount is less than zero

when the source is exhausted before byteCount bytes could be read