-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random access to files #231
Comments
@fzhinkin I also am in need of this feature, as I am also using Okio's |
@ptitjes there is a plan to add proper file support to kotlinx-io (replacing or extending existing API that was added mainly to plug a few specific use cases), but the corresponding API should be designed first. The latter means that Okio's FS API will be considered but will be not necessarily taken as is. |
I was also looking for random access files, so I ended up writing a pretty simple implementation to get me by for the JVM. Maybe you could consider it in the design. Example usage:
Code: |
Multiplatform
Source
s andSink
s are already great features, but it would also be nice to have random-access capabilities like Okio'sFileHandle
class. TheBufferView
option discussed in #225 would help in some cases, but in other cases it's impractical to load the entire file into memory to get at a small part of it—reading a few individual files from an archive, for example. As far as I know the only way to do this right now is to create a newSource
and skip to the specified offset, which isn't particularly convenient. (In fact, if I'm reading the code correctly, theskip
function does read everything up until that point into a buffer temporarily? Which would make it a no-go for those usecases as well.)(I've tried to search both the repo and Slack to make sure there wasn't existing discussion about this, but if I've missed something please point me to it!)
The text was updated successfully, but these errors were encountered: