https://kotlinlang.org logo
#io
Title
# io
e

elect

10/18/2023, 7:57 AM
so, I'm reading a ~5mb file with okio After consuming few bytes, I do need to
seek
to a specific location, however I get
java.lang.ArrayIndexOutOfBoundsException: offset=25403 > size=7365
I guess because the 8k segment just run out However, if I try instead to consume bytes infinitely, I can consume around 4.7MB before I reach the end of the file (
java.io.EOFException
) So, is the
seek
just for segments? How can I
seek
for positions outside the current segment?
or maybe
FileHandle
?
so,
FileHandle
looks what I needed, but I need to jump forth and back from
FileHandle
and
BufferedSource
..
f

Filipp Zhinkin

10/18/2023, 11:17 AM
>
size=7365
It refers to the size of a buffer, not a particular segment. You can try calling `request`/`require` on a source before using
seek
to ensure that enough data were buffered.