org.apache.lucene.store
Class NIOFSDirectory

java.lang.Object
  extended by org.apache.lucene.store.Directory
      extended by org.apache.lucene.store.FSDirectory
          extended by org.apache.lucene.store.NIOFSDirectory

public class NIOFSDirectory
extends FSDirectory

NIO version of FSDirectory. Uses FileChannel.read(ByteBuffer dst, long position) method which allows multiple threads to read from the file without synchronizing. FSDirectory synchronizes in the FSIndexInput.readInternal method which can cause pileups when there are many threads accessing the Directory concurrently. This class only uses FileChannel when reading; writing with an IndexOutput is inherited from FSDirectory. 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: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6265734

See Also:
FSDirectory

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.store.FSDirectory
FSDirectory.FSIndexInput, FSDirectory.FSIndexOutput
 
Field Summary
 
Fields inherited from class org.apache.lucene.store.FSDirectory
LOCK_DIR
 
Fields inherited from class org.apache.lucene.store.Directory
lockFactory
 
Constructor Summary
NIOFSDirectory()
           
 
Method Summary
 IndexInput openInput(String name, int bufferSize)
          Returns a stream reading an existing file, with the specified read buffer size.
 
Methods inherited from class org.apache.lucene.store.FSDirectory
close, createOutput, deleteFile, fileExists, fileLength, fileModified, fileModified, getDirectory, getDirectory, getDirectory, getDirectory, getDirectory, getDirectory, getDisableLocks, getFile, getLockID, list, openInput, renameFile, setDisableLocks, sync, toString, touchFile
 
Methods inherited from class org.apache.lucene.store.Directory
clearLock, copy, ensureOpen, getLockFactory, makeLock, setLockFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NIOFSDirectory

public NIOFSDirectory()
Method Detail

openInput

public IndexInput openInput(String name,
                            int bufferSize)
                     throws IOException
Description copied from class: Directory
Returns a stream reading an existing file, with the specified read buffer size. The particular Directory implementation may ignore the buffer size. Currently the only Directory implementations that respect this parameter are FSDirectory and CompoundFileReader.

Overrides:
openInput in class FSDirectory
Throws:
IOException


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.