Package io.ktor.utils.io.jvm.javaio

Extensions for External Classes

java.io.InputStream

Functions

copyTo

suspend fun ByteReadChannel.copyTo(
    out: OutputStream,
    limit: Long = Long.MAX_VALUE
): Long

Copies up to limit bytes from this byte channel to out stream suspending on read channel and blocking on output

toInputStream

fun ByteReadChannel.toInputStream(
    parent: Job? = null
): InputStream

Create blocking java.io.InputStream for this channel that does block every time the channel suspends at read Similar to do reading in runBlocking however you can pass it to regular blocking API

toOutputStream

fun ByteWriteChannel.toOutputStream(
    parent: Job? = null
): OutputStream

Create blocking java.io.OutputStream for this channel that does block every time the channel suspends at write Similar to do reading in runBlocking however you can pass it to regular blocking API