Save This Page
Home » lucene-2.4.1-src » org.apache » lucene » store » [javadoc | source]
org.apache.lucene.store
public class: FSDirectory [javadoc | source]
java.lang.Object
   org.apache.lucene.store.Directory
      org.apache.lucene.store.FSDirectory

Direct Known Subclasses:
    MMapDirectory, NIOFSDirectory, GCJDirectory

Straightforward implementation of Directory as a directory of files. Locking implementation is by default the SimpleFSLockFactory , but can be changed either by passing in a LockFactory instance to getDirectory, or specifying the LockFactory class by setting org.apache.lucene.store.FSDirectoryLockFactoryClass Java system property, or by calling #setLockFactory after creating the Directory.

Directories are cached, so that, for a given canonical path, the same FSDirectory instance will always be returned by getDirectory. This permits synchronization on directories.

Nested Class Summary:
protected static class  FSDirectory.FSIndexInput   
protected static class  FSDirectory.FSIndexOutput   
Field Summary
public static final  String LOCK_DIR    Directory specified by org.apache.lucene.lockDir or java.io.tmpdir system property.
     
    Fields inherited from org.apache.lucene.store.Directory:
    isOpen,  lockFactory
    Constructor:
     protected FSDirectory() 
    Method from org.apache.lucene.store.FSDirectory Summary:
    close,   createOutput,   deleteFile,   fileExists,   fileLength,   fileModified,   fileModified,   getDirectory,   getDirectory,   getDirectory,   getDirectory,   getDirectory,   getDirectory,   getDisableLocks,   getFile,   getLockID,   list,   openInput,   openInput,   renameFile,   setDisableLocks,   sync,   toString,   touchFile
    Methods from org.apache.lucene.store.Directory:
    clearLock,   close,   copy,   createOutput,   deleteFile,   ensureOpen,   fileExists,   fileLength,   fileModified,   getLockFactory,   getLockID,   list,   makeLock,   openInput,   openInput,   renameFile,   setLockFactory,   sync,   touchFile
    Methods from java.lang.Object:
    equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
    Method from org.apache.lucene.store.FSDirectory Detail:
     public synchronized  void close() 
      Closes the store to future operations.
     public IndexOutput createOutput(String name) throws IOException 
      Creates a new, empty file in the directory with the given name. Returns a stream writing this file.
     public  void deleteFile(String name) throws IOException 
      Removes an existing file in the directory.
     public boolean fileExists(String name) 
      Returns true iff a file with the given name exists.
     public long fileLength(String name) 
      Returns the length in bytes of a file in the directory.
     public long fileModified(String name) 
      Returns the time the named file was last modified.
     public static long fileModified(File directory,
        String name) 
      Returns the time the named file was last modified.
     public static FSDirectory getDirectory(String path) throws IOException 
      Returns the directory instance for the named location.
     public static FSDirectory getDirectory(File file) throws IOException 
      Returns the directory instance for the named location.
     public static FSDirectory getDirectory(String path,
        LockFactory lockFactory) throws IOException 
      Returns the directory instance for the named location.
     public static FSDirectory getDirectory(File file,
        LockFactory lockFactory) throws IOException 
      Returns the directory instance for the named location.
     public static FSDirectory getDirectory(String path,
        boolean create) throws IOException 
    Deprecated! Use - IndexWriter's create flag, instead, to create a new index.

      Returns the directory instance for the named location.
     public static FSDirectory getDirectory(File file,
        boolean create) throws IOException 
    Deprecated! Use - IndexWriter's create flag, instead, to create a new index.

      Returns the directory instance for the named location.
     public static boolean getDisableLocks() 
      Returns whether Lucene's use of lock files is disabled.
     public File getFile() 
     public String getLockID() 
     public String[] list() 
      Returns an array of strings, one for each Lucene index file in the directory.
     public IndexInput openInput(String name) throws IOException 
     public IndexInput openInput(String name,
        int bufferSize) throws IOException 
     public synchronized  void renameFile(String from,
        String to) throws IOException 
    Deprecated!
      Renames an existing file in the directory. Warning: This is not atomic.
     public static  void setDisableLocks(boolean doDisableLocks) 
      Set whether Lucene's use of lock files is disabled. By default, lock files are enabled. They should only be disabled if the index is on a read-only medium like a CD-ROM.
     public  void sync(String name) throws IOException 
     public String toString() 
      For debug output.
     public  void touchFile(String name) 
      Set the modified time of an existing file to now.