read

abstract suspend fun read(buffer: ByteArray, offset: Int, length: Int): Int

Reads up to length bytes into buffer starting at offset.

Return

the number of bytes read, or -1 if the stream has reached end-of-file.

Throws

IOException

if reading from the channel fails.

CancellationException

if the coroutine is cancelled.