README.md

The straight dope

Grab it

Run it

You now have a test filesystem in ~/hellofs.
You'll find a file called hello.txt in there.

There's another example filesystem that you can use, which is writable:

fuse-jna/examples/memoryfs.sh ~/memoryfs

Make your own filesystem

Subclass net.fusejna.FuseFilesystem and override the methods you need (For convenience, there is an adapter called FuseFilesystemAdapterFull).

Create an instance of your subclass, then call .mount(mountpoint) on it.

The filesystem will be unmounted automatically at JVM shutdown time if possible. You can unmount it at runtime using .unmount().

???

Profit.

(Bonus) You can get logging for free by calling .log(true) or .log(myLogger) on the filesystem instance.

The longer stuff

The idea

fuse-jna was born out of the desire for no-compilation-required, no-bullshit, actually-working bindings to the FUSE library.

Originally built to make the OS X/Linux port of SrcDemo² possible, it was separated into its own library because I figured others would benefit from it.

I like Python, and I like using fuse.py when writing FUSE filesystems in Python. Thanks to ctypes, it comes in just one file and that's all you need for nice 'n' straight Python bindings.
The goal of fuse-jna is to bring FUSE bindings to Java with the same simplicity.

To do that, it uses JNA, which itself was inspired by Python's ctypes in terms of ease-of-use.

"Help! It's too slow!"

First and foremost, this library uses JNA for bindings, rather than JNI. Do not expect native performance. If you need native performance, look elsewhere.

This being said, you can greatly increase throughput by preventing FUSE from chunking writes in tiny blocks, tweaking some JVM parameters, etc. See issue 31 for details.

Other fuse libraries have popped up that use JNR instead of JNA. You might want to use them instead: javafs, jnr-fuse.