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

Functions

copyTo
Link copied to clipboard
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
suspend fun InputStream.copyTo(channel: ByteWriteChannel, limit: Long = Long.MAX_VALUE): Long
Copies up to limit bytes from this input stream to CIO byte channel blocking on reading this stream and suspending on channel if required
toByteReadChannel
Link copied to clipboard
fun InputStream.toByteReadChannel(context: CoroutineContext = Dispatchers.IO, pool: ObjectPool<ByteBuffer>): ByteReadChannel
Open a channel and launch a coroutine to copy bytes from the input stream to the channel.
@JvmName(name = toByteReadChannelWithArrayPool)
fun InputStream.toByteReadChannel(context: CoroutineContext = Dispatchers.IO, pool: ObjectPool<ByteArray> = ByteArrayPool): ByteReadChannel
Open a channel and launch a coroutine to copy bytes from the input stream to the channel.
toInputStream
Link copied to clipboard
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
Link copied to clipboard
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