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

Directory

public abstract class Directory extends Object
A Directory is a flat list of files. Files may be written once, when they are created. Once a file is created it may only be opened for read, or deleted. Random access is permitted both when reading and writing.

Java's i/o APIs not used directly, but rather all i/o is through this API. This permits things such as:

  • implementation of RAM-based indices;
  • implementation indices stored in a database, via JDBC;
  • implementation of an index as a single file;
author
Doug Cutting

Fields Summary
Constructors Summary
Methods Summary
public abstract voidclose()
Closes the store.

public OutputStreamcreateFile(java.lang.String name)

deprecated
use {@link #createOutput(String)}

    return (OutputStream)createOutput(name);
  
public org.apache.lucene.store.IndexOutputcreateOutput(java.lang.String name)
Creates a new, empty file in the directory with the given name. Returns a stream writing this file.

    // default implementation for back compatibility
    // this method should be abstract
    return (IndexOutput)createFile(name);
  
public abstract voiddeleteFile(java.lang.String name)
Removes an existing file in the directory.

public abstract booleanfileExists(java.lang.String name)
Returns true iff a file with the given name exists.

public abstract longfileLength(java.lang.String name)
Returns the length of a file in the directory.

public abstract longfileModified(java.lang.String name)
Returns the time the named file was last modified.

public abstract java.lang.String[]list()
Returns an array of strings, one for each file in the directory.

public abstract org.apache.lucene.store.LockmakeLock(java.lang.String name)
Construct a {@link Lock}.

param
name the name of the lock file

public InputStreamopenFile(java.lang.String name)

deprecated
use {@link #openInput(String)}

    return (InputStream)openInput(name);
  
public org.apache.lucene.store.IndexInputopenInput(java.lang.String name)
Returns a stream reading an existing file.

    // default implementation for back compatibility
    // this method should be abstract
    return (IndexInput)openFile(name);
  
public abstract voidrenameFile(java.lang.String from, java.lang.String to)
Renames an existing file in the directory. If a file already exists with the new name, then it is replaced. This replacement should be atomic.

public abstract voidtouchFile(java.lang.String name)
Set the modified time of an existing file to now.