You'd need to write a filesystem driver. On Linux you can use FUSE if you don't want to do kernel programming, at the cost of performance. I don't know about options for Windows or Mac OS.
You've tagged this question with the Java tag, but you're more likely to have to use C or C++. If your driver will run in a userspace process (such as via FUSE), I guess you could load a JVM and write stub C functions that just proxy to Java methods, but that's probably more trouble than it's worth.