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 StreamTable
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 keyvoid
put(java.lang.Object key, int val)
Set the int value associated with this keyvoid
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 keyvoid
put(java.lang.Object key, java.net.URL val)
Set the url value associated with this keyvoid
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 keychar
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, 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:
isStreamTable
in interfaceStreamObject
-
isStreamVector
public boolean isStreamVector()- Specified by:
isStreamVector
in interfaceStreamObject
-
startingDelimiter
public char startingDelimiter() -
merge
public void merge(java.util.Hashtable ht) -
deepClone
-
readFrom
- Throws:
StringEncodingException
java.io.IOException
-
readFrom
- Specified by:
readFrom
in interfaceStreamObject
- Throws:
StringEncodingException
-
readFrom
- Specified by:
readFrom
in interfaceStreamObject
- Throws:
StringEncodingException
java.io.IOException
-
readFromFile
- 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
- Throws:
StringEncodingException
java.io.IOException
-
readTheRest
- Specified by:
readTheRest
in interfaceStreamObject
- 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 classjava.util.Hashtable
-
writeToString
public java.lang.String writeToString()- Specified by:
writeToString
in interfaceStreamObject
-
writeTo
public void writeTo(java.io.Writer out) throws java.io.IOException- Specified by:
writeTo
in interfaceStreamObject
- Throws:
java.io.IOException
-
writeTo
public void writeTo(java.io.Writer out, java.lang.String prefix) throws java.io.IOException- Specified by:
writeTo
in 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:
put
in interfacejava.util.Map
- Overrides:
put
in 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
-