readPacket

open suspend fun readPacket(
    size: Int,
    headerSizeHint: Int
): ByteReadPacket

Overrides ByteReadChannel.readPacket

Reads the specified amount of bytes and makes a byte packet from them. Fails if channel has been closed and not enough bytes available. Accepts headerSizeHint to be provided, see WritePacket.