Replies: 1 comment 2 replies
-
|
I think the function you’ve written is a good solution to this problem. It’s potentially easier to write code like this vs. built-ins in Okio. As for optimized skipping… I’m a bit skeptical that it’s worth the effort. You can use FileHandle to random access a file, but skipping on a stream is making an inefficient path faster. Generally better to pick data structures or APIs where skipping is either efficient or unnecessary. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've got a use case where I need to implement skipping efficiently due to a file type. I wonder if it would be feasible to add a signature to
Sourcelike:Some bias, I'm trying to avoid reimplementing
BufferedSource'sskip(...)to monkey-patch an implementation to cast down to a separate interface.An alternative would be to use a different interface and do a
is SkippableSourceor similar when callingBuffer.skip().I'm curious if this is anything taht would be considered.
Beta Was this translation helpful? Give feedback.
All reactions