public class NIOFSDirectory extends FSDirectory
FSDirectoryimplementation that uses java.nio's FileChannel's positional read, which allows multiple threads to read from the same file without synchronizing.
This class only uses FileChannel when reading; writing is achieved with
NOTE: NIOFSDirectory is not recommended on Windows because of a bug in how FileChannel.read is implemented in Sun's JRE. Inside of the implementation the position is apparently synchronized. See here for details.
NOTE: Accessing this class either directly or
indirectly from a thread while it's interrupted can close the
underlying file descriptor immediately if at the same time the thread is
blocked on IO. The file descriptor will remain closed and subsequent access
NIOFSDirectory will throw a
your application uses either
Future.cancel(boolean) you should use
|Modifier and Type||Class and Description|
Reads bytes with
DEFAULT_READ_CHUNK_SIZE, directory, staleFiles
|Constructor and Description|
Create a new NIOFSDirectory for the named location and
Create a new NIOFSDirectory for the named location.
|Modifier and Type||Method and Description|
Creates an IndexInput for the file with the given name.
close, createOutput, deleteFile, ensureCanWrite, fileExists, fileLength, fsync, getDirectory, getLockID, getReadChunkSize, listAll, listAll, onIndexOutputClosed, open, open, setLockFactory, setReadChunkSize, sync, toString
clearLock, ensureOpen, getLockFactory, makeLock
public NIOFSDirectory(File path, LockFactory lockFactory) throws IOException
public IndexInput openInput(String name, IOContext context) throws IOException
public Directory.IndexInputSlicer createSlicer(String name, IOContext context) throws IOException
Directory.IndexInputSlicerfor the given file name. IndexInputSlicer allows other
Directoryimplementations to efficiently open one or more sliced
IndexInputinstances from a single file handle. The underlying file handle is kept open until the
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.