Skip to content
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

MappedResizableBuffer for read-only files #168

Closed
darthninja1 opened this issue Feb 21, 2019 · 2 comments
Closed

MappedResizableBuffer for read-only files #168

darthninja1 opened this issue Feb 21, 2019 · 2 comments

Comments

@darthninja1
Copy link

darthninja1 commented Feb 21, 2019

The IoUtil.map call assumes you have r/w access to the file. I have a usecase where I need to mmap a read-only file generated by a different process. Could you add support for read-only files?

I locally modified the below line in MappedResizableBuffer and it seems to work fine now -

addressOffset = IoUtil.map(fileChannel, FileChannel.MapMode.READ_ONLY, offset, length);

@mjpt777
Copy link
Contributor

mjpt777 commented Feb 21, 2019

Why do you need a resizable buffer if read only? Why not do a normally mapping and wrap with UnsafeBuffer?

@darthninja1
Copy link
Author

Because UnsafeBuffer takes integer offsets (afaik). I have to mmap a file > 2GB. And I want to avoid re-wrapping different sections of the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants