transferFrom
Removes all bytes from source and write them to this sink. Returns the number of bytes read which will be 0 if source is exhausted.
Parameters
source
the source to consume data from.
Throws
when the sink or source is closed.
when some I/O error occurs.
Samples
import kotlinx.io.*
import kotlin.test.*
fun main() {
//sampleStart
val src: Source = Buffer().also { it.writeString("Some data to transfer") }
val dst = Buffer().also { it.writeString("Transferred: ") }
dst.transferFrom(src)
assertTrue(src.exhausted())
assertEquals("Transferred: Some data to transfer", dst.readString())
//sampleEnd
}