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

Didier Villevalois

10/10/2023, 12:46 PM
Hi! I am using Okio on a project where I need to index a file. I was naively looking for a
BufferedSource
property that tells me how many bytes I have already read. It seems there is no direct mean to do that. I have routines that read individual packets from a
BufferedSource
. How would you proceed?
m

mbonnin

10/10/2023, 12:58 PM
Wrap your
BufferedSource
into another one that delegates to it and increments a byte counter?
d

Didier Villevalois

10/10/2023, 1:00 PM
@mbonnin yeah, this was my initial though but unfortunately
BufferedSource
is a sealed interface.
Does anyone see another way to proceed than to wrap
BufferedSource
? @jw Would you consider this a sufficient use-case to unseal the
BufferedSource
interface? Or maybe should I contribute an
OffsetCountingSource
directly to
okio
? (PS: I see that
Source
from
kotlinx-io
is also sealed.)