2

Programs such as Truecrypt or Dropbox offer a comfortable way for file handling. At least under Windows Truecrypt mounts a new drive which feels natural, like a physical drive. Dropbox creates a new folder that can automatically upload/download data.

If I want to implement something similar, is then Java’s FileSystemProvider the right way to do it?

What I want is that a new folder appears and lists (remote) files which are not present on the user’s system. But when the user tries to open such a file or copy it to some other path then this should work as expected.

  • 1
    As I read it, a FileSystemProvider can be used to build something that functions like a filesystem to your Java program -- if you wanted to map a filesystem to a database, for example -- but doesn't plug into the operating system's filesystem drivers and thus doesn't appear to be a filesystem to anything outside your program. I'd be very surprised if there's any way to do this in Java. Device-driver-level hackery is not something Java's particularly suited to. (Not saying it's impossible, just that I wouldn't expect anyone to have put in the effort to make it possible.) – keshlam Feb 11 '14 at 04:58

1 Answers1

1

To create a virtual filesystem visible to all (or chosen) applications in the system you need to create a filesystem driver on Windows (on Linux and MacOS there exist FUSE and OSXFUSE respectively). This is a slow and painful process.

Java's classes, as @keshlam wrote in the comment, are not suitable for creation of the system-visible virtual disk.

Again for Windows you can check our Callback File System product that lets you write the business logic in user mode and provides a pre-created filesystem kernel-mode driver. It includes Java API so you can use it in Java. Due to differences in filesystem architecture in Unix-based OS and Windows the APIs are different from those found in FUSE though.

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121