readFully

suspend fun ByteReadChannel.readFully(out: ByteArray, start: Int = 0, end: Int = out.size)(source)

Reads bytes from start to end into the provided out buffer, or fails if the channel has been closed.

Suspension occurs when there are not enough bytes available in the channel.

Report a problem

Parameters

out

the buffer to write to

start

the index to start writing at

end

the index to write until

suspend fun <Error class: unknown class>.readFully(buffer: ByteBuffer)(source)

Reads data from the ByteReadChannel into the provided buffer until the buffer is fully filled or EOF is reached.

Parameters

buffer

the ByteBuffer into which bytes are read from the channel.

Throws

EOFException

if the channel is closed or there are not enough bytes available to fill the buffer.