Package io.ktor.utils.io.streams

Functions

Link copied to clipboard
fun InputStream.asInput(pool: ObjectPool<ChunkBuffer> = ChunkBuffer.Pool): Input
Link copied to clipboard
fun OutputStream.asOutput(): Output
Link copied to clipboard
fun ByteReadPacket.inputStream(): InputStream

Creates InputStream adapter to the packet

Link copied to clipboard
fun BytePacketBuilder.outputStream(): OutputStream

Creates OutputStream adapter to the builder

Link copied to clipboard
fun ByteReadPacket.readerUTF8(): Reader

Creates Reader from the byte packet that decodes UTF-8 characters

Link copied to clipboard
fun InputStream.readPacketAtLeast(n: Long): ByteReadPacket

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

Link copied to clipboard
fun InputStream.readPacketAtMost(n: Long): ByteReadPacket

Read a packet of at most n bytes. Resulting packet could be empty however this function always reads as much bytes as possible.

Link copied to clipboard
fun InputStream.readPacketExact(n: Long): ByteReadPacket

Read a packet of exactly n bytes

Link copied to clipboard
fun OutputStream.writePacket(packet: ByteReadPacket)

Write the whole packet to the stream

fun OutputStream.writePacket(builder: BytePacketBuilder.() -> Unit)

Write the whole packet to the stream once it is built via builder lambda

Link copied to clipboard
fun BytePacketBuilder.writerUTF8(): Writer

Creates Writer that encodes all characters in UTF-8 encoding