File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
integration/kotlinx-io-okio/common Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -109,8 +109,8 @@ public fun okio.Sink.asKotlinxIoRawSink(): RawSink = object : RawSink {
109109 buffer.write(data, from, toRead)
110110 toRead
111111 }
112- this @asKotlinxIoRawSink.write(buffer, byteCount)
113112 }
113+ this @asKotlinxIoRawSink.write(buffer, byteCount)
114114 }
115115
116116 override fun flush () = withOkio2KxIOExceptionMapping {
Original file line number Diff line number Diff line change @@ -52,6 +52,19 @@ class OkioAdaptersTest {
5252 }
5353 }
5454
55+ @Test
56+ fun okioSinkLargeWrite () {
57+ val arrayLength = 8193
58+ val data = ByteArray (arrayLength) { it.toByte() }
59+ val kxBuffer = kotlinx.io.Buffer ().also { it.write(data) }
60+ val okioBuffer = okio.Buffer ()
61+ val okioSink = okioBuffer as okio.Sink
62+ val wrapper = okioSink.asKotlinxIoRawSink()
63+ wrapper.write(kxBuffer, arrayLength.toLong())
64+ assertContentEquals(data, okioBuffer.readByteArray())
65+ assertTrue(kxBuffer.exhausted())
66+ }
67+
5568 @Test
5669 fun okioSinkViewDelegation () {
5770 var closed = false
You can’t perform that action at this time.
0 commit comments