readBytes

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.


fun Input.readBytes(n: Int): ByteArray

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


fun Input.readBytes(): ByteArray

Reads all remaining bytes from the input