com.moneydance.util
Class StreamTable

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable
          extended by com.moneydance.util.StreamTable
All Implemented Interfaces:
DeepClone, StreamObject, java.io.Serializable, java.lang.Cloneable, java.util.Map

public class StreamTable
extends java.util.Hashtable
implements StreamObject, DeepClone

Subclass of Hashtable that can read and write itself to a stream.

See Also:
Serialized Form

Constructor Summary
StreamTable()
           
StreamTable(int initialCapacity)
           
StreamTable(int initialCapacity, float loadFactor)
           
 
Method Summary
 java.lang.Object deepClone()
           
 java.lang.Object get(java.lang.Object key, java.lang.Object defaultVal)
           
 boolean getBoolean(java.lang.Object key, boolean defaultVal)
          Get the boolean value associated with the given key.
 int getInt(java.lang.Object key, int defaultVal)
          Get the integer value associated with the given key.
 java.lang.String[] getKeyArray()
          Get an array consisting of the keys for this hashtable.
 long getLong(java.lang.Object key, long defaultVal)
          Get the long value associated with the given key.
 java.lang.String getStr(java.lang.Object key, java.lang.String defaultVal)
          Get the string value associated with the given key.
 java.lang.String[] getStrList(java.lang.Object key)
          Get the list of strings associated with the given key.
 boolean isStreamTable()
           
 boolean isStreamVector()
           
static void main(java.lang.String[] argv)
           
 void merge(java.util.Hashtable ht)
           
 void put(java.lang.Object key, boolean val)
          Set the boolean value associated with this key
 void put(java.lang.Object key, int val)
          Set the int value associated with this key
 void put(java.lang.Object key, long val)
          Set the long value associated with this key.
 java.lang.Object put(java.lang.Object key, java.lang.Object val)
           
 void put(java.lang.Object key, java.lang.String val)
          Set the string value associated with this key
 void put(java.lang.Object key, java.net.URL val)
          Set the url value associated with this key
 void readFrom(java.io.InputStream in)
           
 void readFrom(java.io.Reader str)
           
 void readFrom(java.lang.String str)
           
 void readFromFile(java.io.File file)
           
 void readFromFile(java.lang.String fileName)
           
 void readTheRest(java.io.Reader str)
           
 void setField(java.lang.Object key, java.lang.String[] strList)
          Set the string array value associated with this key
 char startingDelimiter()
           
 java.lang.String toString()
           
 void writeTo(java.io.OutputStream out)
           
 void writeTo(java.io.Writer out)
           
 void writeTo(java.io.Writer out, java.lang.String prefix)
           
 void writeToFile(java.io.File file)
           
 void writeToFile(java.lang.String fileName)
           
 java.lang.String writeToString()
           
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StreamTable

public StreamTable()

StreamTable

public StreamTable(int initialCapacity)

StreamTable

public StreamTable(int initialCapacity,
                   float loadFactor)
Method Detail

get

public java.lang.Object get(java.lang.Object key,
                            java.lang.Object defaultVal)

isStreamTable

public boolean isStreamTable()
Specified by:
isStreamTable in interface StreamObject

isStreamVector

public boolean isStreamVector()
Specified by:
isStreamVector in interface StreamObject

startingDelimiter

public char startingDelimiter()

merge

public void merge(java.util.Hashtable ht)

deepClone

public java.lang.Object deepClone()
Specified by:
deepClone in interface DeepClone

readFrom

public void readFrom(java.io.InputStream in)
              throws StringEncodingException,
                     java.io.IOException
Throws:
StringEncodingException
java.io.IOException

readFrom

public void readFrom(java.lang.String str)
              throws StringEncodingException
Specified by:
readFrom in interface StreamObject
Throws:
StringEncodingException

readFrom

public void readFrom(java.io.Reader str)
              throws StringEncodingException,
                     java.io.IOException
Specified by:
readFrom in interface StreamObject
Throws:
StringEncodingException
java.io.IOException

readFromFile

public void readFromFile(java.io.File file)
                  throws StringEncodingException,
                         java.io.IOException
Throws:
StringEncodingException
java.io.IOException

readFromFile

public void readFromFile(java.lang.String fileName)
                  throws StringEncodingException,
                         java.io.IOException
Throws:
StringEncodingException
java.io.IOException

writeToFile

public void writeToFile(java.lang.String fileName)
                 throws StringEncodingException,
                        java.io.IOException
Throws:
StringEncodingException
java.io.IOException

writeToFile

public void writeToFile(java.io.File file)
                 throws StringEncodingException,
                        java.io.IOException
Throws:
StringEncodingException
java.io.IOException

readTheRest

public void readTheRest(java.io.Reader str)
                 throws StringEncodingException,
                        java.io.IOException
Specified by:
readTheRest in interface StreamObject
Throws:
StringEncodingException
java.io.IOException

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
Throws:
java.lang.Exception

toString

public java.lang.String toString()
Overrides:
toString in class java.util.Hashtable

writeToString

public java.lang.String writeToString()
Specified by:
writeToString in interface StreamObject

writeTo

public void writeTo(java.io.Writer out)
             throws java.io.IOException
Specified by:
writeTo in interface StreamObject
Throws:
java.io.IOException

writeTo

public void writeTo(java.io.Writer out,
                    java.lang.String prefix)
             throws java.io.IOException
Specified by:
writeTo in interface StreamObject
Throws:
java.io.IOException

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException
Throws:
java.io.IOException

getInt

public int getInt(java.lang.Object key,
                  int defaultVal)
Get the integer value associated with the given key. If there is no integer value associated with the key, return the defaultVal.


getLong

public long getLong(java.lang.Object key,
                    long defaultVal)
Get the long value associated with the given key. If there is no long value associated with the key, return the defaultVal.


getBoolean

public boolean getBoolean(java.lang.Object key,
                          boolean defaultVal)
Get the boolean value associated with the given key. If there is no boolean value associated with the key, return the defaultVal.


getStr

public java.lang.String getStr(java.lang.Object key,
                               java.lang.String defaultVal)
Get the string value associated with the given key. If there is no value associated with the key, return the defaultVal.


getStrList

public java.lang.String[] getStrList(java.lang.Object key)
Get the list of strings associated with the given key.


getKeyArray

public java.lang.String[] getKeyArray()
Get an array consisting of the keys for this hashtable.


put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object val)
Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.Hashtable

put

public void put(java.lang.Object key,
                long val)
Set the long value associated with this key.


put

public void put(java.lang.Object key,
                boolean val)
Set the boolean value associated with this key


put

public void put(java.lang.Object key,
                java.lang.String val)
Set the string value associated with this key


put

public void put(java.lang.Object key,
                int val)
Set the int value associated with this key


put

public void put(java.lang.Object key,
                java.net.URL val)
Set the url value associated with this key


setField

public void setField(java.lang.Object key,
                     java.lang.String[] strList)
Set the string array value associated with this key