FileDocCategorySizeDatePackage
MMapDirectory.javaAPI DocApache Lucene 1.96442Mon Feb 20 09:20:16 GMT 2006org.apache.lucene.store

MMapDirectory

public class MMapDirectory extends FSDirectory
File-based {@link Directory} implementation that uses mmap for input.

To use this, invoke Java with the System property org.apache.lucene.FSDirectory.class set to org.apache.lucene.store.MMapDirectory. This will cause {@link FSDirectory#getDirectory(File,boolean)} to return instances of this class.

Fields Summary
private final int
MAX_BBUF
Constructors Summary
Methods Summary
public org.apache.lucene.store.IndexInputopenInput(java.lang.String name)


        
    File f =  new File(getFile(), name);
    RandomAccessFile raf = new RandomAccessFile(f, "r");
    try {
      return (raf.length() <= MAX_BBUF)
             ? (IndexInput) new MMapIndexInput(raf)
             : (IndexInput) new MultiMMapIndexInput(raf, MAX_BBUF);
    } finally {
      raf.close();
    }