encfs4j icon indicating copy to clipboard operation
encfs4j copied to clipboard

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

Open indiscrete-void opened this issue 4 years ago • 0 comments

https://github.com/usrflo/encfs4j/blob/2ae3cc665dba4e95404b74bf9e50eea05af81321/src/main/java/de/agitos/encfs4j/CipherFileChannel.java#L132 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

indiscrete-void avatar Jan 23 '22 21:01 indiscrete-void