Package com.infinitekind.util
Class StreamTable
java.lang.Object
java.util.Dictionary<K,V>
java.util.Hashtable
com.infinitekind.util.StreamTable
- All Implemented Interfaces:
StreamObject,java.io.Serializable,java.lang.Cloneable,java.util.Map
public class StreamTable extends java.util.Hashtable implements StreamObject
Subclass of Hashtable that can read and write itself to
a stream.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description StreamTable()StreamTable(int initialCapacity)StreamTable(int initialCapacity, float loadFactor) -
Method Summary
Modifier and Type Method Description StreamTabledeepClone()java.lang.Objectget(java.lang.Object key, java.lang.Object defaultVal)booleangetBoolean(java.lang.Object key, boolean defaultVal)Get the boolean value associated with the given key.intgetInt(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.longgetLong(java.lang.Object key, long defaultVal)Get the long value associated with the given key.java.lang.StringgetStr(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.booleanisStreamTable()booleanisStreamVector()static voidmain(java.lang.String[] argv)voidmerge(java.util.Hashtable ht)voidput(java.lang.Object key, boolean val)Set the boolean value associated with this keyvoidput(java.lang.Object key, int val)Set the int value associated with this keyvoidput(java.lang.Object key, long val)Set the long value associated with this key.java.lang.Objectput(java.lang.Object key, java.lang.Object val)voidput(java.lang.Object key, java.lang.String val)Set the string value associated with this keyvoidput(java.lang.Object key, java.net.URL val)Set the url value associated with this keyvoidreadFrom(java.io.InputStream in)voidreadFrom(java.io.Reader str)voidreadFrom(java.lang.String str)voidreadFromFile(java.io.File file)voidreadFromFile(java.lang.String fileName)voidreadTheRest(java.io.Reader str)voidsetField(java.lang.Object key, java.lang.String[] strList)Set the string array value associated with this keycharstartingDelimiter()java.lang.StringtoString()voidwriteTo(java.io.OutputStream out)voidwriteTo(java.io.Writer out)voidwriteTo(java.io.Writer out, java.lang.String prefix)voidwriteToFile(java.io.File file)voidwriteToFile(java.lang.String fileName)java.lang.StringwriteToString()Methods inherited from class java.util.Hashtable
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, values
-
Constructor Details
-
StreamTable
public StreamTable() -
StreamTable
public StreamTable(int initialCapacity) -
StreamTable
public StreamTable(int initialCapacity, float loadFactor)
-
-
Method Details
-
get
public java.lang.Object get(java.lang.Object key, java.lang.Object defaultVal) -
isStreamTable
public boolean isStreamTable()- Specified by:
isStreamTablein interfaceStreamObject
-
isStreamVector
public boolean isStreamVector()- Specified by:
isStreamVectorin interfaceStreamObject
-
startingDelimiter
public char startingDelimiter() -
merge
public void merge(java.util.Hashtable ht) -
deepClone
-
readFrom
- Throws:
StringEncodingExceptionjava.io.IOException
-
readFrom
- Specified by:
readFromin interfaceStreamObject- Throws:
StringEncodingException
-
readFrom
- Specified by:
readFromin interfaceStreamObject- Throws:
StringEncodingExceptionjava.io.IOException
-
readFromFile
- Throws:
StringEncodingExceptionjava.io.IOException
-
readFromFile
public void readFromFile(java.lang.String fileName) throws StringEncodingException, java.io.IOException- Throws:
StringEncodingExceptionjava.io.IOException
-
writeToFile
public void writeToFile(java.lang.String fileName) throws StringEncodingException, java.io.IOException- Throws:
StringEncodingExceptionjava.io.IOException
-
writeToFile
- Throws:
StringEncodingExceptionjava.io.IOException
-
readTheRest
- Specified by:
readTheRestin interfaceStreamObject- Throws:
StringEncodingExceptionjava.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:
toStringin classjava.util.Hashtable
-
writeToString
public java.lang.String writeToString()- Specified by:
writeToStringin interfaceStreamObject
-
writeTo
public void writeTo(java.io.Writer out) throws java.io.IOException- Specified by:
writeToin interfaceStreamObject- Throws:
java.io.IOException
-
writeTo
public void writeTo(java.io.Writer out, java.lang.String prefix) throws java.io.IOException- Specified by:
writeToin interfaceStreamObject- 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:
putin interfacejava.util.Map- Overrides:
putin classjava.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
-