The JavaProperties class loads and saves Java style properties from a Stream. This version uses C# friendly names and implements the most important features of the Java Properties class in Sun Java version 1.5.0 with some methods omitted (e.g. the loadFrom/storeToXML methods as C# provides simple alternatives and any
More...
|
class | LineReader |
| A private class to read lines from the input stream in the special escaped ".properties" format. More...
|
|
|
| JavaProperties () |
| Creates an empty property list with no default values. More...
|
|
| JavaProperties (JavaProperties defaults) |
| Creates an empty property list with the specified defaults. More...
|
|
void | Load (Stream inStream) |
| Reads a property list (key and element pairs) from the input stream. The stream is assumed to be using the ISO 8859-1 character encoding; that is each byte is one Latin1 character. Characters not in Latin1, and certain special characters, can be represented in keys and elements using escape sequences. More...
|
|
void | Store (Stream output, string comments) |
| Writes this property list (key and element pairs) in this JavaProperties table to the output stream in a format suitable for loading into a JavaProperties table using the load method. The stream is written using the ISO 8859-1 character encoding. More...
|
|
string | GetProperty (string key) |
| Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns More...
|
|
string | GetProperty (string key, string defaultValue) |
| Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found. More...
|
|
Object | SetProperty (string key, string newValue) |
| Adds a string key/value property pair to the underlying Hashtable. Enforces use of strings for property keys and values. More...
|
|
IEnumerator | PropertyNames () |
| Returns an enumeration of all the keys in this property list, including distinct keys in the default property list if a key of the same name has not already been found from the main properties list. More...
|
|
The JavaProperties class loads and saves Java style properties from a Stream. This version uses C# friendly names and implements the most important features of the Java Properties class in Sun Java version 1.5.0 with some methods omitted (e.g. the loadFrom/storeToXML methods as C# provides simple alternatives and any
NOTE: An important detail to remember is that non-string keys and values were usually ignored in the Java version - I have used 'ToString()' to allow them to be handled more easily.
See http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html for full details.
PushTechnology.DiffusionCore.PropertyHandler.JavaProperties.JavaProperties |
( |
| ) |
|
Creates an empty property list with no default values.
PushTechnology.DiffusionCore.PropertyHandler.JavaProperties.JavaProperties |
( |
JavaProperties |
defaults | ) |
|
Creates an empty property list with the specified defaults.
- Parameters
-
defaults | An instance of JavaProperties containing default values for the properties. |
string PushTechnology.DiffusionCore.PropertyHandler.JavaProperties.GetProperty |
( |
string |
key | ) |
|
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns
null
if the property is not found.
- Parameters
-
- Returns
- The value in this property list with the specified key.
string PushTechnology.DiffusionCore.PropertyHandler.JavaProperties.GetProperty |
( |
string |
key, |
|
|
string |
defaultValue |
|
) |
| |
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found.
- Parameters
-
key | The hashtable key. |
defaultValue | A default value. |
- Returns
- The value in this property list with the specified key value.
void PushTechnology.DiffusionCore.PropertyHandler.JavaProperties.Load |
( |
Stream |
inStream | ) |
|
Reads a property list (key and element pairs) from the input stream. The stream is assumed to be using the ISO 8859-1 character encoding; that is each byte is one Latin1 character. Characters not in Latin1, and certain special characters, can be represented in keys and elements using escape sequences.
See http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream)
- Parameters
-
inStream | The input stream to read properties from. |
IEnumerator PushTechnology.DiffusionCore.PropertyHandler.JavaProperties.PropertyNames |
( |
| ) |
|
Returns an enumeration of all the keys in this property list, including distinct keys in the default property list if a key of the same name has not already been found from the main properties list.
- Returns
- An enumeration of all the keys in this property list, including the keys in the default property list.
Object PushTechnology.DiffusionCore.PropertyHandler.JavaProperties.SetProperty |
( |
string |
key, |
|
|
string |
newValue |
|
) |
| |
Adds a string key/value property pair to the underlying Hashtable. Enforces use of strings for property keys and values.
- Parameters
-
key | the property name to use as the key. |
newValue | the value of the property. |
- Returns
- an Object - which should be a string if properties have been used property.
void PushTechnology.DiffusionCore.PropertyHandler.JavaProperties.Store |
( |
Stream |
output, |
|
|
string |
comments |
|
) |
| |
Writes this property list (key and element pairs) in this JavaProperties table to the output stream in a format suitable for loading into a JavaProperties table using the load method. The stream is written using the ISO 8859-1 character encoding.
- Parameters
-
output | An output stream. |
comments | A description of the property list to add to the top of the properties file. |
JavaProperties PushTechnology.DiffusionCore.PropertyHandler.JavaProperties.defaults |
|
protected |
A property list that contains default values for any keys not found in this property list.