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 fread(buffer: Buffer, stream: <ERROR CLASS><<ERROR CLASS>>): <ERROR CLASS>
fun fread(destination: Memory, offset: Int, length: Int, stream: <ERROR CLASS><<ERROR CLASS>>): Int
fun fread(destination: Memory, offset: Long, length: Long, stream: <ERROR CLASS><<ERROR CLASS>>): Long
Link copied to clipboard
fun fwrite(buffer: Buffer, stream: <ERROR CLASS><<ERROR CLASS>>): <ERROR CLASS>
fun fwrite(source: Memory, offset: Int, length: Int, stream: <ERROR CLASS><<ERROR CLASS>>): Int
fun fwrite(source: Memory, offset: Long, length: Long, stream: <ERROR CLASS><<ERROR CLASS>>): Long
Link copied to clipboard
fun Input(file: <ERROR CLASS><<ERROR CLASS>>): Input

Create a blocking Input reading from the specified file instance using fread.

fun Input(fileDescriptor: Int): Input

Create a blocking Input reading from the specified fileDescriptor using read.

Link copied to clipboard
fun ByteReadPacket.inputStream(): InputStream

Creates InputStream adapter to the packet

Link copied to clipboard
fun Output(file: <ERROR CLASS><<ERROR CLASS>>): Output

Create a blocking Output writing to the specified file instance using fwrite.

fun Output(fileDescriptor: Int): Output

Create a blocking Output writing to the specified fileDescriptor using write.

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

Creates OutputStream adapter to the builder

Link copied to clipboard
fun read(fildes: Int, buffer: Buffer): <ERROR CLASS>
fun read(fildes: Int, destination: Memory, offset: Int, length: Int): Int
fun read(fildes: Int, destination: Memory, offset: Long, length: Long): Long
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 recv(socket: <ERROR CLASS>, buffer: Buffer, flags: Int): <ERROR CLASS>
Link copied to clipboard
fun recvfrom(socket: <ERROR CLASS>, buffer: Buffer, flags: Int, addr: <ERROR CLASS><<ERROR CLASS>>, addr_len: <ERROR CLASS><<ERROR CLASS>>): <ERROR CLASS>
Link copied to clipboard
fun send(socket: <ERROR CLASS>, buffer: Buffer, flags: Int): <ERROR CLASS>
fun send(socket: <ERROR CLASS>, source: Memory, sourceOffset: Int, maxLength: Int, flags: Int): Int
fun send(socket: <ERROR CLASS>, source: Memory, sourceOffset: Long, maxLength: Long, flags: Int): Long
Link copied to clipboard
fun sendto(socket: <ERROR CLASS>, buffer: Buffer, flags: Int, addr: <ERROR CLASS><<ERROR CLASS>>, addr_len: <ERROR CLASS>): <ERROR CLASS>
Link copied to clipboard
inline fun <R> <ERROR CLASS><<ERROR CLASS>>.use(block: (<ERROR CLASS><<ERROR CLASS>>) -> R): R
Link copied to clipboard
fun write(fildes: Int, buffer: Buffer): <ERROR CLASS>
fun write(fildes: Int, source: Memory, offset: Int, length: Int): Int
fun write(fildes: Int, source: Memory, offset: Long, length: Long): Long
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