readPacketAtMost

fun ReadableByteChannel.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. You also can use it with non-blocking channels