ktor-io / io.ktor.utils.io.streams / java.io.InputStream / readPacketAtMost

readPacketAtMost

fun InputStream.readPacketAtMost(n: Long): ByteReadPacket

Read a packet of at most n bytes. Resulting packet could be empty however this function does always reads as much bytes as possible.