fun Buffer.readBytes(count: Int = readRemaining): ByteArray

Read the specified number of bytes specified (optional, read all remaining by default)

fun ByteReadPacket.readBytes(n: Int = remaining.coerceAtMostMaxIntOrFail("Unable to convert to a ByteArray: packet is too big")): ByteArray

Read exactly n bytes (consumes all remaining if n is not specified but up to Int.MAX_VALUE bytes). Does fail if not enough bytes remaining.

Reads exactly n bytes from the input or fails if not enough bytes available.

Reads all remaining bytes from the input