public class SimpleFSDirectory extends FSDirectory
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.Modifier and Type | Class and Description |
---|---|
protected static class |
SimpleFSDirectory.SimpleFSIndexInput
Reads bytes with
RandomAccessFile.seek(long) followed by
RandomAccessFile.read(byte[], int, int) . |
FSDirectory.FSIndexInput, FSDirectory.FSIndexOutput
Directory.IndexInputSlicer
DEFAULT_READ_CHUNK_SIZE, directory, staleFiles
isOpen, lockFactory
Constructor and Description |
---|
SimpleFSDirectory(File path)
Create a new SimpleFSDirectory for the named location and
NativeFSLockFactory . |
SimpleFSDirectory(File path,
LockFactory lockFactory)
Create a new SimpleFSDirectory for the named location.
|
Modifier and Type | Method and Description |
---|---|
Directory.IndexInputSlicer |
createSlicer(String name,
IOContext context)
Creates an
Directory.IndexInputSlicer for the given file name. |
IndexInput |
openInput(String name,
IOContext context)
Creates an IndexInput for the file with the given name.
|
close, createOutput, deleteFile, ensureCanWrite, fileExists, fileLength, fileModified, fsync, getDirectory, getLockID, getReadChunkSize, listAll, listAll, onIndexOutputClosed, open, open, setLockFactory, setReadChunkSize, sync, toString
clearLock, copy, ensureOpen, getLockFactory, makeLock
public SimpleFSDirectory(File path, LockFactory lockFactory) throws IOException
path
- the path of the directorylockFactory
- the lock factory to use, or null for the default
(NativeFSLockFactory
);IOException
- if there is a low-level I/O errorpublic SimpleFSDirectory(File path) throws IOException
NativeFSLockFactory
.path
- the path of the directoryIOException
- if there is a low-level I/O errorpublic IndexInput openInput(String name, IOContext context) throws IOException
openInput
in class Directory
IOException
public Directory.IndexInputSlicer createSlicer(String name, IOContext context) throws IOException
Directory
Directory.IndexInputSlicer
for the given file name.
IndexInputSlicer allows other Directory
implementations to
efficiently open one or more sliced IndexInput
instances from a
single file handle. The underlying file handle is kept open until the
Directory.IndexInputSlicer
is closed.createSlicer
in class Directory
IOException
- if an IOException
occursCopyright © 2000-2013 Apache Software Foundation. All Rights Reserved.