org.erowid.sperosearch.splitindex
Class SplitIndexDirectoryDescriptor

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

public class SplitIndexDirectoryDescriptor
extends Object
implements Cloneable

Information about a directory with a split index. Files, sizes, etc. This operates in two modes : read only from a URL, and read/write from a File that is the data directory.

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

Field Summary
protected static String DESCRIPTOR_FILE_NAME
          Name of the descriptor file.
protected static int DESCRIPTOR_VERSION_NUMBER
          The descriptor version.
 
Constructor Summary
protected SplitIndexDirectoryDescriptor(URL url)
          Creates a read-only descriptor.
 
Method Summary
protected  void addFileDescriptor(SplitIndexFileDescriptor descriptor)
          Returns the map of file descriptors, so that extending classes may manipulate it.
protected  Object clone()
           
 boolean fileExists(String filename)
          Checks for file existence.
 SplitIndexFileDescriptor getFileDescriptor(String filename)
          Gets a file descriptor by name.
static SplitIndexDirectoryDescriptor getInstance(URL url)
          Creates a read only directory descriptor.
 int getSegmentSize()
          Returns the size of a given segment, before compression.
 URL getUrl()
          The URL of this directory, for reading.
 String[] listFiles()
          Lists the filenames of all files.
 void loadDescriptor()
          Loads this directory descriptor.
protected  void setSegmentSize(int segmentSize)
          Sets the segment size, preperator to saving.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESCRIPTOR_FILE_NAME

protected static final String DESCRIPTOR_FILE_NAME
Name of the descriptor file.

See Also:
Constant Field Values

DESCRIPTOR_VERSION_NUMBER

protected static final int DESCRIPTOR_VERSION_NUMBER
The descriptor version. This must match in the given descriptor file, or it just won't work.

See Also:
Constant Field Values
Constructor Detail

SplitIndexDirectoryDescriptor

protected SplitIndexDirectoryDescriptor(URL url)
Creates a read-only descriptor.

Method Detail

getInstance

public static SplitIndexDirectoryDescriptor getInstance(URL url)
Creates a read only directory descriptor.


clone

protected Object clone()
                throws CloneNotSupportedException
Throws:
CloneNotSupportedException

addFileDescriptor

protected void addFileDescriptor(SplitIndexFileDescriptor descriptor)
Returns the map of file descriptors, so that extending classes may manipulate it.


getFileDescriptor

public SplitIndexFileDescriptor getFileDescriptor(String filename)
Gets a file descriptor by name.


getUrl

public URL getUrl()
The URL of this directory, for reading.


getSegmentSize

public int getSegmentSize()
Returns the size of a given segment, before compression. Returns 0 if it isn't set yet, or hasn't been loaded.


setSegmentSize

protected void setSegmentSize(int segmentSize)
Sets the segment size, preperator to saving.


loadDescriptor

public void loadDescriptor()
                    throws IOException
Loads this directory descriptor. Clearly, this must stay in synch with WriteableSplitIndexDirectoryDescriptor.saveDescriptor().

Throws:
IOException - If there's a problem reading.

listFiles

public String[] listFiles()
Lists the filenames of all files.


fileExists

public boolean fileExists(String filename)
                   throws IOException
Checks for file existence.

Throws:
IOException

spero logo small Sperowider is
© 2005 Erowid.org