FileDocCategorySizeDatePackage
Directory.javaAPI DocApache Lucene 1.4.32856Tue Mar 30 00:48:06 BST 2004org.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 abstract OutputStreamcreateFile(java.lang.String name)
Creates a new, empty file in the directory with the given name. Returns a stream writing this file.

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 abstract InputStreamopenFile(java.lang.String name)
Returns a stream reading an existing file.

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.