org.egothor.robot.index
Class DocumentsFastWriter

java.lang.Object
  extended by org.egothor.robot.index.DocumentsFastWriter

public class DocumentsFastWriter
extends java.lang.Object

DocumentsFastWriter can construct a structure that is described in Documents. It can also add an element to an already existing structure.

Author:
Leo Galambos

Constructor Summary
DocumentsFastWriter(java.lang.String location)
          Constructor for the DocumentsFastWriter.
 
Method Summary
 long addElement(DocumentData obj)
          Appends a new object to the structure.
 void close()
          Close the two files opened in the constructor.
 void save(DocumentData doc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentsFastWriter

public DocumentsFastWriter(java.lang.String location)
                    throws java.io.IOException
Constructor for the DocumentsFastWriter. The writer is constructed in the specified directory which must exist. Then it stores an empty bit map of removed documents to a bitmap file. Finally, it opens idocs and docs files for write. If the files exist, they are overwritten.

Parameters:
location - the directory to write to
runnable - the index must be able to run, not only to be readable via DocumentsReader
Throws:
java.io.IOException - Description of the Exception
IOException - if an I/O error occurs
Method Detail

save

public void save(DocumentData doc)
          throws java.io.IOException
Throws:
java.io.IOException

addElement

public long addElement(DocumentData obj)
                throws java.io.IOException
Appends a new object to the structure. Its unique identification in the structure is returned. The object added must be of type Saveable.

Parameters:
obj - the element to add
Returns:
the unique identifier of the element
Throws:
java.io.IOException

close

public void close()
Close the two files opened in the constructor.