com.strangegizmo.cdb
Class CdbMake

java.lang.Object
  |
  +--com.strangegizmo.cdb.CdbMake

public final class CdbMake
extends java.lang.Object

CdbMake implements the database-creation side of D. J. Bernstein's constant database package.


Constructor Summary
CdbMake()
          Constructs a CdbMake object and prepares it for the creation of a constant database.
 
Method Summary
 void add(byte[] key, byte[] data)
          Adds a key to the constant database.
 void finish()
          Finalizes the constant database.
static void make(java.io.InputStream in, java.lang.String cdbFilepath, java.lang.String tempFilepath)
          Builds a CDB file from a CDB-format InputStream.
static void make(java.io.InputStream in, java.lang.String cdbFilepath, java.lang.String tempFilepath, Cdb ignoreCdb)
          Builds a CDB file from a CDB-format InputStream, excluding records with data matching keys in `ignoreCdb'.
static void make(java.lang.String dataFilepath, java.lang.String cdbFilepath, java.lang.String tempFilepath)
          Builds a CDB file from a CDB-format text file.
static void make(java.lang.String dataFilepath, java.lang.String cdbFilepath, java.lang.String tempFilepath, Cdb ignoreCdb)
          Builds a CDB file from a CDB-format text file, excluding records with data matching keys in `ignoreCdb'.
 void start(java.lang.String filepath)
          Begins the constant database creation process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CdbMake

public CdbMake()
Constructs a CdbMake object and prepares it for the creation of a constant database.
Method Detail

start

public void start(java.lang.String filepath)
           throws java.io.IOException
Begins the constant database creation process.
Parameters:
filepath - The path to the constant database to create.
Throws:
java.io.IOException - If an error occurs creating the constant database file.

add

public void add(byte[] key,
                byte[] data)
         throws java.io.IOException
Adds a key to the constant database.
Parameters:
key - The key to add to the database.
data - The data associated with this key.
Throws:
java.io.IOException - If an error occurs adding the key to the database.

finish

public void finish()
            throws java.io.IOException
Finalizes the constant database.
Throws:
java.io.IOException - If an error occurs closing out the database.

make

public static void make(java.lang.String dataFilepath,
                        java.lang.String cdbFilepath,
                        java.lang.String tempFilepath)
                 throws java.io.IOException
Builds a CDB file from a CDB-format text file.
Parameters:
dataFilepath - The CDB data file to read.
cdbFilepath - The CDB file to create.
tempFilepath - The temporary file to use when creating the CDB file.
Throws:
java.io.IOException - if an error occurs rebuilding the CDB file.

make

public static void make(java.lang.String dataFilepath,
                        java.lang.String cdbFilepath,
                        java.lang.String tempFilepath,
                        Cdb ignoreCdb)
                 throws java.io.IOException
Builds a CDB file from a CDB-format text file, excluding records with data matching keys in `ignoreCdb'.
Parameters:
dataFilepath - The CDB data file to read.
cdbFilepath - The CDB file to create.
tempFilepath - The temporary file to use when creating the CDB file.
ignoreCdb - If the data for an entry matches a key in this CDB file, the entry will not be added to the new file.
Throws:
java.io.IOException - if an error occurs rebuilding the CDB file.

make

public static void make(java.io.InputStream in,
                        java.lang.String cdbFilepath,
                        java.lang.String tempFilepath)
                 throws java.io.IOException
Builds a CDB file from a CDB-format InputStream.
Parameters:
in - The InputStream to read.
cdbFilepath - The CDB file to create.
tempFilepath - The temporary file to use when creating the CDB file.
Throws:
java.io.IOException - if an error occurs rebuilding the CDB file.

make

public static void make(java.io.InputStream in,
                        java.lang.String cdbFilepath,
                        java.lang.String tempFilepath,
                        Cdb ignoreCdb)
                 throws java.io.IOException
Builds a CDB file from a CDB-format InputStream, excluding records with data matching keys in `ignoreCdb'.
Parameters:
in - The InputStream to read.
cdbFilepath - The CDB file to create.
tempFilepath - The temporary file to use when creating the CDB file.
ignoreCdb - If the data for an entry matches a key in this CDB file, the entry will not be added to the new file.
Throws:
java.io.IOException - if an error occurs rebuilding the CDB file.