|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable
info.aduna.gee.publication.util.WProperties
public class WProperties
WProperties is the ZPad equivalent of java.util.Properties.
It differs from java.util.Properties in:
- SPEED
-- WProperties in optimized especially in "load".
- MEMORY
-- Key and Value strings are shared.
- STORAGE
-- WProperties does not generate comment or dates.
- DEFAULTS AND EMPTY VALUES
-- A getProperty returns the value or "".
-- So a "" value can not be destinguished from non-presence of the key.
-- But note: you still have to store key="" pairs in order
support the correct containsKey() !
We don't support line continuation.
We do support blanks in keys, except for \n or \r.
We do support \r as line separator, besides the default \n. This is manual editing in Windows only.
| Constructor Summary | |
|---|---|
WProperties()
Creates an empty property list. |
|
WProperties(byte[] in)
Constructs a property list and loads the byte array. |
|
WProperties(Properties p)
Convert a Properties to a WProperties. |
|
WProperties(String s)
Constructs a property list and loads s. |
|
| Method Summary | |
|---|---|
protected int |
_getExpandedSize(char[] anArray)
|
boolean |
equals(Object other)
Two WProperties are equal * if their number of keys are equal * every key in "this" is also key in "that" * if for every key, the corresponding values are equal. |
int |
getIntProperty(String key)
Gets a int-property with the specified key. |
String |
getKeyOf(String value)
In a lot of circumstances the WProperties is a one-to-one mapping of key and value. |
WProperties |
getProperties(int key)
Gets a WProperties with the specified key. |
WProperties |
getProperties(String key)
Gets a WProperties with the specified key. |
String |
getProperty(int key)
Gets a property with the specified key. |
String |
getProperty(String key)
Gets a property with the specified key. |
void |
load(InputStream in)
Loads properties from an InputStream. |
WProperties |
mergeWith(WProperties other)
(Re)set all key-value pairs in this WProperties that are defined in the other WProperties. |
Object |
put(int key,
Object value)
A lot of ZPad WProperties are used to store N. |
Object |
put(String key,
int value)
A lot of ZPad WProperties are used to store "int" values. |
Object |
put(String key,
String value)
Share all Key and Value strings. |
void |
save(OutputStream out)
Save properties to an OutputStream. |
void |
save(OutputStream prnt,
boolean localize,
int level)
Save properties at a certain level to a PrintStream. |
Properties |
toProperties()
Convert a WProperties to a Properties. |
String |
toString()
|
| Methods inherited from class java.util.Hashtable |
|---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public WProperties()
public WProperties(Properties p)
p - null or a Properties containing the initial key/value pairspublic WProperties(String s)
public WProperties(byte[] in)
| Method Detail |
|---|
public Properties toProperties()
public void load(InputStream in)
throws IOException
in - the input stream
IOException - Error when reading from input stream.
public void save(OutputStream out)
throws IOException
IOException
public void save(OutputStream prnt,
boolean localize,
int level)
throws IOException
prnt - the OutputStream to save tolocalize - if true, localization by the PrintStream is automaticlevel - the nesting level of Properties
IOException
public Object put(int key,
Object value)
key - the hashtable key.value - the value.
public Object put(String key,
int value)
key - the hashtable key.value - the value.
public Object put(String key,
String value)
public String getProperty(String key)
key - the key to look for
public String getProperty(int key)
key - the key to look for.the - property stored under 'key', "" if not found.public int getIntProperty(String key)
key - the key to look for
public WProperties getProperties(String key)
public WProperties getProperties(int key)
public String getKeyOf(String value)
public WProperties mergeWith(WProperties other)
other - contains the key-value pairs to be set or is null
public boolean equals(Object other)
equals in interface Mapequals in class Hashtablepublic String toString()
toString in class Hashtableprotected int _getExpandedSize(char[] anArray)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||