Closed vegidio closed 3 months ago
That code is not responsible for the exception, although you're missing a call to .use { ... }
after .buffer()
.
The problem with the actual offending code is that you're passing more than Int.MAX_VALUE
to Buffer.readByteString
. A Buffer
can hold more than Int.MAX_VALUE
but a ByteString
cannot.
The lack of .use {...}
in my code was indeed the source of the problem. Thank you very much!
I created the code with Ktor and Okio to stream download a file:
This function works well with most files, but I noticed that sometimes I throws the following exception that seems to be coming from
okio.Buffer#readByteString
:Do you have any idea what could be happening here? This is a KMP program running in a Mac.
Thanks!