Richard Searle


Streaming data via fuse-jna

03 Mar 2015

The fuse-jna project provides an convenient mechanism to implement a user space file system, using Java.

I encountered a need to stream data using custom serial hardware that is accessed via a proprietary Java API. With fuse-jna, the API can be mapped into a file system that contains a file for each port.

The only difficulty was reading the data from the port. The read expects the implementation to fill the specified buffer. fuse appears to assume that a half filled buffer indicates EOF.

This problem was resolved by using direct-io, which is easily enabled in the open implementation.

public int open(String path, FileInfoWrapper info) {

A character based implementation using CUSE would presumably be a better match, but the fuse-jna project does not support it. An extensive search only found one usage of CUSE and a single example, indicating this functionality is probably orphaned.