Package org.apache.lucene.misc.store
Class RAFDirectory
java.lang.Object
org.apache.lucene.store.Directory
org.apache.lucene.store.BaseDirectory
org.apache.lucene.store.FSDirectory
org.apache.lucene.misc.store.RAFDirectory
- All Implemented Interfaces:
Closeable
,AutoCloseable
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.
-
Field Summary
Fields inherited from class org.apache.lucene.store.FSDirectory
directory
Fields inherited from class org.apache.lucene.store.BaseDirectory
isOpen, lockFactory
-
Constructor Summary
ConstructorDescriptionRAFDirectory
(Path path) Create a new RAFDirectory for the named location andFSLockFactory.getDefault()
.RAFDirectory
(Path path, LockFactory lockFactory) Create a new RAFDirectory for the named location. -
Method Summary
Modifier and TypeMethodDescriptionCreates an IndexInput for the file with the given name.Methods inherited from class org.apache.lucene.store.FSDirectory
close, createOutput, createTempOutput, deleteFile, deletePendingFiles, ensureCanRead, fileLength, fsync, getDirectory, getPendingDeletions, listAll, listAll, open, open, rename, sync, syncMetaData, toString
Methods inherited from class org.apache.lucene.store.BaseDirectory
ensureOpen, obtainLock
Methods inherited from class org.apache.lucene.store.Directory
copyFrom, getTempFileName, openChecksumInput
-
Constructor Details
-
RAFDirectory
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 directorylockFactory
- the lock factory to use- Throws:
IOException
- if there is a low-level I/O error
-
RAFDirectory
Create a new RAFDirectory for the named location andFSLockFactory.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
-
openInput
Creates an IndexInput for the file with the given name.- Specified by:
openInput
in classDirectory
- Throws:
IOException
-