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

Implementation of CipherFileChannel isn't usable for non default FileSystem implementations #5

Open
indiscrete-void opened this issue Jan 23, 2022 · 0 comments

Comments

@indiscrete-void
Copy link

this.persistentFile = new RandomAccessFile(path.toFile(), "rw");

This line of code suggests that CipherFileChannel always requires sub file system to implement toFile() method. This method links very versatile java nio file system framework with legacy java io File class, which is only suitable for local files. Thus CipherFileChannel will not work with any file system implementation that can't represent path as local file. Examples are: In-memory file system, remote file system, distributed filesystem, http file system, etc...
I suggest using FileChannel#open instead of creating new RandomAccessFile. Note that FileChannel implements SeekableByteChannel

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

No branches or pull requests

1 participant