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 |
|
fun InputStream.toByteReadChannel(context: <ERROR CLASS> = Dispatchers.IO, pool: ObjectPool<ByteBuffer>): ByteReadChannel fun InputStream.toByteReadChannel(context: <ERROR CLASS> = Dispatchers.IO, pool: ObjectPool<ByteArray> = ByteArrayPool): ByteReadChannel
Open a channel and launch a coroutine to copy bytes from the input stream to the channel. Please note that it may block your async code when started on Dispatchers.Unconfined since InputStream is blocking on it's nature |