await

abstract suspend fun await(atLeast: Int = 1): Boolean

Suspend until atLeast bytes become available or end of stream encountered (possibly due to exceptional close)

Return

true if there are atLeast bytes available or false if end of stream encountered (there still could be bytes available but less than atLeast)

Throws

if the channel has been closed with an exception or cancelled

if atLeast is negative to too big (usually bigger than 4088)