com.partnersoft.io.formats.dump
Class NamedRandomAccessObjectDump

java.lang.Object
  extended by com.partnersoft.io.formats.dump.NamedRandomAccessObjectDump

public class NamedRandomAccessObjectDump
extends java.lang.Object

This is similar to the ObjectDump, except that it is indexed by a string 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. Not threadsafe. Write a wrapper if you need thread safety.

Compressed by default; optional constructor for uncompressed mode.


Constructor Summary
NamedRandomAccessObjectDump(java.lang.String filename)
          Creates a NamedRandomAccessObjectDump file for the given filename base (everything but the extensions).
 
Method Summary
 void close()
           
 int[] findAllMatches(java.lang.String name)
           
 int getSize()
           
 java.lang.String readName(int index)
           
 java.lang.Object readObject(int index)
           
 java.lang.Object readObject(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamedRandomAccessObjectDump

public NamedRandomAccessObjectDump(java.lang.String filename)
                            throws java.io.IOException
Creates a NamedRandomAccessObjectDump file for the given filename base (everything but the extensions).

Throws:
java.io.IOException
Method Detail

getSize

public int getSize()

close

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

findAllMatches

public int[] findAllMatches(java.lang.String name)
                     throws java.io.IOException
Throws:
java.io.IOException

readObject

public java.lang.Object readObject(java.lang.String name)
                            throws java.io.IOException
Throws:
java.io.IOException

readObject

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

readName

public java.lang.String readName(int index)
                          throws java.io.IOException
Throws:
java.io.IOException