ccs.cdb
Class CDBDirectory

java.lang.Object
  extended by ccs.beetree.BeeObject
      extended by ccs.cdb.CDBObject
          extended by ccs.cdb.CDBFileSysObject
              extended by ccs.cdb.CDBDirectory
All Implemented Interfaces:
java.io.Serializable

public class CDBDirectory
extends CDBFileSysObject

An object which stores a table of unique strings as a CDBObject. This is used to provide listings of "directories" of CDBFiles. This allows a CDB of CDBFiles to be used as a "virtual filesystem". The strings are stored in memory by a hashtable.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class ccs.cdb.CDBObject
clone, key, marshalVersion, owner
 
Fields inherited from class ccs.beetree.BeeObject
cipher, encodedLength, isBodiless, isForceDirectDecrypt, isZip, slack
 
Constructor Summary
CDBDirectory()
          Create an empty CDBDirectory.
 
Method Summary
 boolean contains(java.lang.String s)
          Whether the a string matching the argument is present in the table.
protected  void cpmarshal(java.io.DataOutputStream dos)
          override this to marshal your data, just like marshal.
protected  void cpunmarshal(java.io.DataInputStream dis, int marshalver)
          override this to unmarshal your data, just like unmarshal.
 void delete(java.lang.String loseMe)
          Deletes the supplied string (well, the one containing the same character sequence as the supplied string, .equals() rather than ==) from the table.
 java.lang.String[] getEntries()
          returns an array containing all the strings in the table.
 int getNEntries()
          Returns the number of entries in the table.
 java.lang.String getPath()
          Returns the previously-set path.
 void insert(java.lang.String newItem)
          Insert a fresh string into the table.
 void setPath(java.lang.String path)
          Set the path (i.e.
 
Methods inherited from class ccs.cdb.CDBObject
canChangeKeyProgrammatically, canDeleteProgrammatically, canUpdateProgrammatically, cpgetKey, cpgetMarshalledLength, cppreMarshal, cppreUnmarshal, cpsetKey, getCDB, getKey, getMarshalledLength, marshal, preMarshal, preUnmarshal, setCDB, setKey, transientMarshal, transientUnmarshal, unmarshal
 
Methods inherited from class ccs.beetree.BeeObject
lock, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDBDirectory

public CDBDirectory()
Create an empty CDBDirectory.

Method Detail

setPath

public void setPath(java.lang.String path)
Set the path (i.e. DB key).


getPath

public java.lang.String getPath()
Returns the previously-set path.


insert

public void insert(java.lang.String newItem)
            throws java.io.IOException
Insert a fresh string into the table. This does not update the BeeTree entry.

Parameters:
newItem - The string to insert.
Throws:
java.io.IOException - if the string is already present in the table.

delete

public void delete(java.lang.String loseMe)
            throws java.io.IOException
Deletes the supplied string (well, the one containing the same character sequence as the supplied string, .equals() rather than ==) from the table. As noted above, all strings are unique so no question of "which one of several identical ones?" arises.

Parameters:
loseMe - The String to remove.
Throws:
java.io.IOException - if no such string is present.

contains

public boolean contains(java.lang.String s)
Whether the a string matching the argument is present in the table.

Parameters:
s - The string to check for.
Returns:
true if s is present, false if not.

getNEntries

public int getNEntries()
Returns the number of entries in the table.

Returns:
the number of entries.

getEntries

public java.lang.String[] getEntries()
returns an array containing all the strings in the table.

Returns:
The strings.

cpmarshal

protected void cpmarshal(java.io.DataOutputStream dos)
                  throws java.io.IOException
Description copied from class: CDBObject
override this to marshal your data, just like marshal. The data will be in the object's fields when this is called (rather than within any UI objects).

Overrides:
cpmarshal in class CDBFileSysObject
Parameters:
dos - The stream to marshal onto.
Throws:
java.io.IOException - If this breaks (breaks the CDB too).

cpunmarshal

protected void cpunmarshal(java.io.DataInputStream dis,
                           int marshalver)
                    throws java.io.IOException
Description copied from class: CDBObject
override this to unmarshal your data, just like unmarshal.

Overrides:
cpunmarshal in class CDBFileSysObject
Parameters:
dis - The stream to unmarshal from
marshalver - The marshal version of the data in src - i.e. the version of this class which wrote the data. This may be different from the current marshalVersion. If so (i.e. the stored data is the wrong version) your method should allow for it. This allows comparatively painless data migration between versions of your objects.
Throws:
java.io.IOException - if this breaks (breaks the CDB too).