com.partnersoft.io.formats.dump
Class NamedObjectDumpBuilder

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

public class NamedObjectDumpBuilder
extends java.lang.Object

This class builds NamedObjectDumps using buffered streams. More efficient than the NamedObjectDump append methods. Building can be stopped and restarted; this allows having a cache of builders, stopping ones that are stale but restarting them later when needed.


Field Summary
protected  java.lang.String filenameBase
           
 
Constructor Summary
NamedObjectDumpBuilder(java.lang.String filename)
          Creates a NamedObjectDump file for the given filename base (everything but the extensions).
 
Method Summary
 void appendBytes(java.lang.String name, byte[] victim)
           
 void appendBytes(java.lang.String name, byte[] victim, int offset, int length)
           
 void appendObject(java.lang.String name, java.lang.Object victim)
           
 void clear()
           
 void close()
          Closes the dump.
 int getCurrentSize()
           
 java.io.File getDataFile()
           
 java.lang.String getFilenameBase()
           
 java.io.File getOffsetFile()
           
 void reset()
           
 void sort()
           
 void writeObjectImp(java.lang.Object victim, java.io.DataOutputStream outie)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filenameBase

protected java.lang.String filenameBase
Constructor Detail

NamedObjectDumpBuilder

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

Throws:
java.io.IOException
Method Detail

getFilenameBase

public java.lang.String getFilenameBase()

getDataFile

public java.io.File getDataFile()

getOffsetFile

public java.io.File getOffsetFile()

appendBytes

public void appendBytes(java.lang.String name,
                        byte[] victim)
                 throws java.io.IOException
Throws:
java.io.IOException

appendBytes

public void appendBytes(java.lang.String name,
                        byte[] victim,
                        int offset,
                        int length)
                 throws java.io.IOException
Throws:
java.io.IOException

appendObject

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

writeObjectImp

public void writeObjectImp(java.lang.Object victim,
                           java.io.DataOutputStream outie)
                    throws java.io.IOException
Throws:
java.io.IOException

clear

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

close

public void close()
           throws java.io.IOException
Closes the dump. You can reopen it by creating a new object or by calling reset();

Throws:
java.io.IOException

sort

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

getCurrentSize

public int getCurrentSize()

reset

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