copyTo

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

Return

number of bytes copied


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

Return

number of bytes copied