com.partnersoft.v3x.io.formats
Class GoedelObjectDump

java.lang.Object
  extended by com.partnersoft.v3x.io.formats.GoedelObjectDump

public class GoedelObjectDump
extends java.lang.Object

This is similar to the ObjectDump, except that it is indexed by a (possibly nonsequential) long ID name rather than an integer ID. Essentially, it is WORM - you can dump an object to it, in which case the object is appended, in serialized form, with its name to the data file, and an entry added to the offset file. You can then ask for that object by index number or ID. So, it's kind of a hashtable except that it doesn't use hashing to find things - more of an ISAMtable. Not threadsafe. Write a wrapper if you need thread safety.


Constructor Summary
GoedelObjectDump(java.lang.String filenameBase)
          Creates a GoedelObjectDump file for the given filename base (everything but the extensions).
 
Method Summary
 void appendObject(long ID, java.lang.Object victim)
           
 void clear()
           
 int getSize()
           
 long readID(int index)
           
 java.lang.Object readObject(int index)
           
 java.lang.Object readObject(long ID)
          This requires that the file be sorted.
 void sort()
           
 void sortInMemory()
           
 void sortOnDisk()
           
 void swap(int a, int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GoedelObjectDump

public GoedelObjectDump(java.lang.String filenameBase)
Creates a GoedelObjectDump file for the given filename base (everything but the extensions).

Method Detail

getSize

public int getSize()

appendObject

public void appendObject(long ID,
                         java.lang.Object victim)
                  throws java.io.IOException
Throws:
java.io.IOException

readObject

public java.lang.Object readObject(long ID)
                            throws java.io.IOException
This requires that the file be sorted. Returns null on fail.

Throws:
java.io.IOException

readObject

public java.lang.Object readObject(int index)
                            throws java.io.IOException
Throws:
java.io.IOException

readID

public long readID(int index)
            throws java.io.IOException
Throws:
java.io.IOException

clear

public void clear()
           throws java.io.IOException
Throws:
java.io.IOException

swap

public void swap(int a,
                 int b)
          throws java.io.IOException
Throws:
java.io.IOException

sort

public void sort()

sortOnDisk

public void sortOnDisk()

sortInMemory

public void sortInMemory()