org.apache.lucene.index
Class CompoundFileReader

java.lang.Object
  extended byorg.apache.lucene.store.Directory
      extended byorg.apache.lucene.index.CompoundFileReader

public class CompoundFileReader
extends Directory

Class for accessing a compound stream. This class implements a directory, but is limited to only read operations. Directory methods that would normally modify data throw an exception.

Version:
$Id: CompoundFileReader.java,v 1.3 2003/11/20 19:01:44 goller Exp $
Author:
Dmitry Serebrennikov

Constructor Summary
CompoundFileReader(Directory dir, String name)
           
 
Method Summary
 void close()
          Closes the store.
 OutputStream createFile(String name)
          Creates a new, empty file in the directory with the given name.
 void deleteFile(String name)
          Removes an existing file in the directory.
 boolean fileExists(String name)
          Returns true iff a file with the given name exists.
 long fileLength(String name)
          Returns the length of a file in the directory.
 long fileModified(String name)
          Returns the time the named file was last modified.
 Directory getDirectory()
           
 String getName()
           
 String[] list()
          Returns an array of strings, one for each file in the directory.
 Lock makeLock(String name)
          Construct a Lock.
 InputStream openFile(String id)
          Returns a stream reading an existing file.
 void renameFile(String from, String to)
          Renames an existing file in the directory.
 void touchFile(String name)
          Set the modified time of an existing file to now.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompoundFileReader

public CompoundFileReader(Directory dir,
                          String name)
                   throws IOException
Method Detail

getDirectory

public Directory getDirectory()

getName

public String getName()

close

public void close()
           throws IOException
Description copied from class: Directory
Closes the store.

Specified by:
close in class Directory
Throws:
IOException

openFile

public InputStream openFile(String id)
                     throws IOException
Description copied from class: Directory
Returns a stream reading an existing file.

Specified by:
openFile in class Directory
Throws:
IOException

list

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

Specified by:
list in class Directory

fileExists

public boolean fileExists(String name)
Returns true iff a file with the given name exists.

Specified by:
fileExists in class Directory

fileModified

public long fileModified(String name)
                  throws IOException
Returns the time the named file was last modified.

Specified by:
fileModified in class Directory
Throws:
IOException

touchFile

public void touchFile(String name)
               throws IOException
Set the modified time of an existing file to now.

Specified by:
touchFile in class Directory
Throws:
IOException

deleteFile

public void deleteFile(String name)
Removes an existing file in the directory.

Specified by:
deleteFile in class Directory

renameFile

public void renameFile(String from,
                       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.

Specified by:
renameFile in class Directory

fileLength

public long fileLength(String name)
                throws IOException
Returns the length of a file in the directory.

Specified by:
fileLength in class Directory
Throws:
IOException

createFile

public OutputStream createFile(String name)
Creates a new, empty file in the directory with the given name. Returns a stream writing this file.

Specified by:
createFile in class Directory

makeLock

public Lock makeLock(String name)
Construct a Lock.

Specified by:
makeLock in class Directory
Parameters:
name - the name of the lock file


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.