read

expect open suspend override fun read(sink: SdkBuffer, limit: Long): Long

Remove at least 1 byte, and up-to limit bytes from this and appends them to sink. Suspends if no bytes are available. Returns the number of bytes read, or -1 if this channel is exhausted. It is not safe to modify sink until this function returns

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

Return

the number of bytes read or -1 if the channel is closed

Parameters

sink

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

limit

the maximum number of bytes to read from the channel

actual open suspend fun read(sink: SdkBuffer, limit: Long): Long