|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Dictionary
com.objectspace.jgl.Map
com.objectspace.jgl.OrderedMap
wt.util.PropertiesMap
PropertiesMap
is an extension of a JGL Map, which adds the ability
to load and save the values of a Map, to a stream, similar to
java.util.Properties
.
What PropertiesMap
adds, beyond what java.util.Properties
provides, is the ability to have multiple entries with the same key.
The following is an example of how PropertiesMap
could be used:
// load properties from a file FileReader fileInput = new FileReader( "c:\temp\my.properties" ); PropertiesMap registry = new PropertiesMap( new LessString(), true ); registry.load( fileInput ); fileInput.close();// add new entry registry.add( "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, "List of class names and their respective package names" ); fileOutput.close();
Properties
,
ClassPathRepository
,
MappedRegistry
,
Serialized FormField Summary | |
private static String |
versionID
|
Fields inherited from class com.objectspace.jgl.OrderedMap |
|
Constructor Summary | |
PropertiesMap()
Construct myself to be an empty PropertiesMap that orders its keys based on the LessString comparator and does not allow duplicates. |
|
PropertiesMap(com.objectspace.jgl.BinaryPredicate comparator)
Construct myself to be an empty PropertiesMap that orders its keys using a specified binary predicate and does not allow duplicates. |
|
PropertiesMap(com.objectspace.jgl.BinaryPredicate comparator,
boolean allowDuplicates)
Construct myself to be an empty PropertiesMap that orders its keys using a specified binary predicate and conditionally allows duplicates. |
|
PropertiesMap(boolean allowDuplicates)
Construct myself to be an empty PropertiesMap that orders its keys based on the LessString comparator and conditionally allows duplicates. |
|
PropertiesMap(PropertiesMap map)
Construct myself to be a shallow copy of an existing PropertiesMap. |
Method Summary | |
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 PropertiesMap with the values from the
Reader . |
protected void |
load(StreamTokenizer tokenStream)
Loads the PropertiesMap with the values from the
StreamTokenizer . |
void |
save(PrintWriter output,
String header)
Saves the key/value pairs of the PropertiesMap to the
PrintWriter . |
Methods inherited from class com.objectspace.jgl.OrderedMap |
add, add, allowsDuplicates, begin, clear, clone, copy, count, countValues, elements, end, equalRange, equals, equals, find, finish, get, getComparator, hashCode, isEmpty, keys, keys, lowerBound, maxSize, put, remove, remove, remove, remove, size, start, swap, toString, upperBound, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final String versionID
Constructor Detail |
public PropertiesMap()
public PropertiesMap(com.objectspace.jgl.BinaryPredicate comparator)
comparator
- The predicate for ordering keys.public PropertiesMap(com.objectspace.jgl.BinaryPredicate comparator, boolean allowDuplicates)
comparator
- The predicate for ordering keys.allowDuplicates
- true if duplicates are allowed.public PropertiesMap(PropertiesMap map)
map
- The PropertiesMap to copy.public PropertiesMap(boolean allowDuplicates)
allowDuplicates
- true if duplicates are allowed.Method Detail |
private StreamTokenizer getTokenStream(InputStream input)
private StreamTokenizer getTokenStream(Reader input)
public void load(InputStream input) throws IOException
PropertiesMap
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
PropertiesMap
with the values from the
Reader
.
input
- the Reader
from which values will be loaded
IOException
protected void load(StreamTokenizer tokenStream) throws IOException
PropertiesMap
with the values from the
StreamTokenizer
.
IOException
public void save(PrintWriter output, String header)
PropertiesMap
to the
PrintWriter
.
header
- optional header to be written as the first line of output
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |