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

All Implemented Interfaces:
    Serializable

A memory-resident Directory implementation. Locking implementation is by default the SingleInstanceLockFactory but can be changed with #setLockFactory .
Field Summary
 HashMap fileMap     
 long sizeInBytes     
Fields inherited from org.apache.lucene.store.Directory:
isOpen,  lockFactory
Constructor:
 public RAMDirectory() 
 public RAMDirectory(Directory dir) throws IOException 
    Creates a new RAMDirectory instance from a different Directory implementation. This can be used to load a disk-based index into memory.

    This should be used only with indices that can fit into memory.

    Note that the resulting RAMDirectory instance is fully independent from the original Directory (it is a complete copy). Any subsequent changes to the original Directory will not be visible in the RAMDirectory instance.

    Parameters:
    dir - a Directory value
    Throws:
    IOException - if an error occurs
    exception: IOException - if an error occurs
 public RAMDirectory(File dir) throws IOException 
    Creates a new RAMDirectory instance from the FSDirectory .
 public RAMDirectory(String dir) throws IOException 
    Creates a new RAMDirectory instance from the FSDirectory .
Method from org.apache.lucene.store.RAMDirectory Summary:
close,   createOutput,   deleteFile,   fileExists,   fileLength,   fileModified,   list,   openInput,   renameFile,   sizeInBytes,   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.RAMDirectory Detail:
 public  void close() 
    Closes the store to future operations, releasing associated memory.
 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 synchronized  void deleteFile(String name) throws IOException 
    Removes an existing file in the directory.
 public final boolean fileExists(String name) 
    Returns true iff the named file exists in this directory.
 public final long fileLength(String name) throws IOException 
    Returns the length in bytes of a file in the directory.
 public final long fileModified(String name) throws IOException 
    Returns the time the named file was last modified.
 public final synchronized String[] list() 
    Returns an array of strings, one for each file in the directory.
 public IndexInput openInput(String name) throws IOException 
    Returns a stream reading an existing file.
 public final synchronized  void renameFile(String from,
    String to) throws IOException 
Deprecated!
    Renames an existing file in the directory.
 public final synchronized long sizeInBytes() 
    Return total size in bytes of all files in this directory. This is currently quantized to RAMOutputStream.BUFFER_SIZE.
 public  void touchFile(String name) throws IOException 
    Set the modified time of an existing file to now.