Extensions for java.io.InputStream

asInput

fun InputStream.asInput(
    pool: ObjectPool<ChunkBuffer> = ChunkBuffer.Pool
): Input

readPacketAtLeast

fun InputStream.readPacketAtLeast(n: Long): ByteReadPacket

Read a packet of at least n bytes or all remaining. Does fail if not enough bytes remaining.

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.

readPacketExact

fun InputStream.readPacketExact(n: Long): ByteReadPacket

Read a packet of exactly n bytes