Skip to content

Commit 074f0a2

Browse files
author
Sergey Mashkov
committed
IO: add limit parameter to copyAndClose helper function
1 parent dfae5e2 commit 074f0a2

File tree

1 file changed

+2
-2
lines changed
  • core/kotlinx-coroutines-io/src/main/kotlin/kotlinx/coroutines/experimental/io

1 file changed

+2
-2
lines changed

core/kotlinx-coroutines-io/src/main/kotlin/kotlinx/coroutines/experimental/io/ByteReadChannel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ private suspend fun ByteReadChannel.copyToImpl(dst: ByteWriteChannel, limit: Lon
240240
* Closes [dst] channel if fails to read or write with cause exception.
241241
* @return a number of copied bytes
242242
*/
243-
suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel): Long {
244-
val count = copyTo(dst)
243+
suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel, limit: Long = Long.MAX_VALUE): Long {
244+
val count = copyTo(dst, limit)
245245
dst.close()
246246
return count
247247
}

0 commit comments

Comments
 (0)