copyTo

suspend fun ByteReadChannel.copyTo(channel: ByteWriteChannel, limit: Long): Long
suspend fun <Error class: unknown class>.copyTo(channel: WritableByteChannel, limit: Long = Long.MAX_VALUE): Long

Copy up to limit bytes to blocking NIO channel. Copying to a non-blocking channel requires selection and not supported. It is suspended if no data are available in a byte channel but may block if destination NIO channel blocks.

Return

number of bytes copied