Class RAFDirectory

All Implemented Interfaces:
Closeable, AutoCloseable

public class RAFDirectory extends FSDirectory
A straightforward implementation of FSDirectory using java.io.RandomAccessFile. However, this class has poor concurrent performance (multiple threads will bottleneck) as it synchronizes when multiple threads read from the same file. It's usually better to use NIOFSDirectory or MMapDirectory instead.

NOTE: Because this uses RandomAccessFile, it will generally not work with non-default filesystem providers. It is only provided for applications that relied on the fact that RandomAccessFile's IO was not interruptible.

  • Constructor Details

    • RAFDirectory

      public RAFDirectory(Path path, LockFactory lockFactory) throws IOException
      Create a new RAFDirectory for the named location. The directory is created at the named location if it does not yet exist.
      Parameters:
      path - the path of the directory
      lockFactory - the lock factory to use
      Throws:
      IOException - if there is a low-level I/O error
    • RAFDirectory

      public RAFDirectory(Path path) throws IOException
      Create a new RAFDirectory for the named location and FSLockFactory.getDefault(). The directory is created at the named location if it does not yet exist.
      Parameters:
      path - the path of the directory
      Throws:
      IOException - if there is a low-level I/O error
  • Method Details