|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap
java.util.HashMap
wt.sysadm.PropertyMap
PropertyMap
is an extension of a HashMap, which adds the
ability to load and save the values of a Map, to a stream, similar to
java.util.Properties
.
What PropertyMap
adds, beyond what
java.util.Properties
provides, is the ability to have
multiple entries with the same key. It also adds the ability to print
the data in same order as read from the original file. Any changes made
are such that only the last occurance of the property is modified.
The following is an example of how PropertyMap
could be used:
// load properties from a file FileReader fileInput = new FileReader( "c:\temp\my.properties" ); PropertyMap registry = new PropertyMap( ); registry.load( fileInput ); fileInput.close();// add new entry registry.put( "String", "java.lang" );
// re-write the properties back to the file PrintWriter fileOutput = new PrintWriter( new FileWriter( "c:\temp\my.properties", false ), true ); registry.save( fileOutput, "Name of user saving the changes" ); fileOutput.close();
Properties
,
Serialized FormNested Class Summary |
Nested classes inherited from class java.util.HashMap |
|
Nested classes inherited from class java.util.AbstractMap |
|
Field Summary | |
private LinkedList |
all
|
private LinkedList |
defaultll
|
private LinkedList |
dll
|
private LinkedList |
ll
|
private LinkedList |
ull
|
Fields inherited from class java.util.HashMap |
|
Fields inherited from class java.util.AbstractMap |
|
Constructor Summary | |
PropertyMap()
Construct myself to be an empty PropertyMap that orders its keys based on the LessString comparator and does not allow duplicates. |
|
PropertyMap(PropertyMap map)
Construct myself to be a shallow copy of an existing PropertyMap. |
Method Summary | |
void |
add(String key,
String value)
|
void |
change(String key,
String value)
|
void |
changeAdd(String key,
String value)
|
void |
changeDefault(String key,
String value)
|
void |
changeDel(String key,
String value)
|
private StreamTokenizer |
getTokenStream(InputStream input)
|
private StreamTokenizer |
getTokenStream(Reader input)
|
void |
load(InputStream input)
Deprecated. Replaced by load(Reader) |
void |
load(Reader input)
Loads the PropertyMap with the values from the
Reader . |
protected void |
load(StreamTokenizer tokenStream)
Loads the PropertyMap with the values from the
StreamTokenizer . |
static void |
main(String[] args)
|
void |
save(PrintWriter output,
String header)
Saves the key/value pairs of the PropertyMap to the
PrintWriter . |
void |
saveSiteXConfFile(String wt_home,
String propFile)
|
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
Field Detail |
private LinkedList ll
private LinkedList all
private LinkedList dll
private LinkedList ull
private LinkedList defaultll
Constructor Detail |
public PropertyMap()
public PropertyMap(PropertyMap map)
map
- The PropertyMap to copy.Method Detail |
private StreamTokenizer getTokenStream(InputStream input)
private StreamTokenizer getTokenStream(Reader input)
public void load(InputStream input) throws IOException
PropertyMap
with the values from the
InputStream
.
input
- the InputStream
from which values will be loaded
IOException
load(Reader)
public void load(Reader input) throws IOException
PropertyMap
with the values from the
Reader
.
input
- the Reader
from which values will be loaded
IOException
protected void load(StreamTokenizer tokenStream) throws IOException
PropertyMap
with the values from the
StreamTokenizer
.
IOException
public void save(PrintWriter output, String header)
PropertyMap
to the
PrintWriter
.
header
- optional header to be written as the first line of outputpublic void change(String key, String value)
public void changeDel(String key, String value)
public void changeAdd(String key, String value)
public void add(String key, String value)
public void changeDefault(String key, String value)
public void saveSiteXConfFile(String wt_home, String propFile)
public static void main(String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |