org.erowid.sperosearch.splitindex
Class WriteableSplitIndexDirectoryDescriptor

java.lang.Object
  extended byorg.erowid.sperosearch.splitindex.SplitIndexDirectoryDescriptor
      extended byorg.erowid.sperosearch.splitindex.WriteableSplitIndexDirectoryDescriptor
All Implemented Interfaces:
Cloneable

public class WriteableSplitIndexDirectoryDescriptor
extends SplitIndexDirectoryDescriptor
implements Cloneable

A writeable form of SplitIndexDirectoryDescriptor. This split was done the way it was to force all file i/o, and specifically all protential uses of the Sperowider FileUtils class into only one class : this one.

Incidentally, only this class and WriteableSplitIndexFileDescriptor are known to Sperowider.

Version:
: $Header: /cvsroot/sperowider/SPEROWIDER_MODULE/javasource/org/erowid/sperosearch/splitindex/WriteableSplitIndexDirectoryDescriptor.java,v 1.1 2005/06/02 06:07:58 gurustu Exp $
Author:
: $Author: gurustu $

Field Summary
 
Fields inherited from class org.erowid.sperosearch.splitindex.SplitIndexDirectoryDescriptor
DESCRIPTOR_FILE_NAME, DESCRIPTOR_VERSION_NUMBER
 
Constructor Summary
WriteableSplitIndexDirectoryDescriptor(File file)
          Creates a(n) WriteableSplitIndexDirectoryDescriptor object.
 
Method Summary
 void addFileDescriptor(SplitIndexFileDescriptor fileDescriptor)
          Adds a file descriptor.
protected  Object clone()
           
 File getFile()
          The File of this directory, for writing.
 void process()
          Does the splitting, zipping, deleting, and then saves the descriptor file.
 void saveDescriptor()
          Saves this directory descriptor.
 void setSegmentSize(int segmentSize)
          Sets the segment size, preperator to saving.
 void unprocess(File destination)
          Mostly for testing purposes, this will take a processed directory of files and its descriptor, and generate the original data from it.
 
Methods inherited from class org.erowid.sperosearch.splitindex.SplitIndexDirectoryDescriptor
fileExists, getFileDescriptor, getInstance, getSegmentSize, getUrl, listFiles, loadDescriptor
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriteableSplitIndexDirectoryDescriptor

public WriteableSplitIndexDirectoryDescriptor(File file)
                                       throws IOException
Creates a(n) WriteableSplitIndexDirectoryDescriptor object.

Method Detail

clone

protected Object clone()
                throws CloneNotSupportedException
Overrides:
clone in class SplitIndexDirectoryDescriptor
Throws:
CloneNotSupportedException

getFile

public File getFile()
The File of this directory, for writing.


process

public void process()
             throws IOException
Does the splitting, zipping, deleting, and then saves the descriptor file.

Throws:
IOException

unprocess

public void unprocess(File destination)
               throws IOException
Mostly for testing purposes, this will take a processed directory of files and its descriptor, and generate the original data from it. Note that this does not use any internal knowledge of segments, but simply uses the SplitIndexFileInputStream objects.

Throws:
IOException

saveDescriptor

public void saveDescriptor()
                    throws IOException,
                           IllegalStateException
Saves this directory descriptor.

Throws:
IOException - If there's a problem writing.
IllegalStateException - If this is not writeable, or segment size is not set.

addFileDescriptor

public void addFileDescriptor(SplitIndexFileDescriptor fileDescriptor)
Adds a file descriptor.

Overrides:
addFileDescriptor in class SplitIndexDirectoryDescriptor

setSegmentSize

public void setSegmentSize(int segmentSize)
Description copied from class: SplitIndexDirectoryDescriptor
Sets the segment size, preperator to saving.

Overrides:
setSegmentSize in class SplitIndexDirectoryDescriptor

spero logo small Sperowider is
© 2005 Erowid.org