https://kotlinlang.org logo
#ktor
Title
# ktor
t

Tianyu Zhu

10/06/2023, 9:09 PM
Hi! What does
ByteReadChannel.readFully()
and
ByteReadChannel.readAvailable()
do? I can't seem to find any documentation on those functions
a

Aleksei Tirman [JB]

10/09/2023, 6:55 AM
ByteReadChannel.readFully:
Reads all length bytes to dst buffer or fails if channel has been closed. Suspends if not enough bytes available.
ByteReadChannel.readAvailable:
Reads all available bytes to dst buffer and returns immediately or suspends if no bytes available. Returns: number of bytes were read or -1 if the channel has been closed