|
|||||||||
| 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<java.lang.Object,java.lang.Object>
java.util.Properties
peersim.config.ConfigProperties
peersim.config.ParsedProperties
public class ParsedProperties
Extends the class ConfigProperties with basic parsing capabilities.
load(java.lang.String),
Serialized Form| Field Summary |
|---|
| Fields inherited from class java.util.Properties |
|---|
defaults |
| Constructor Summary | |
|---|---|
ParsedProperties(java.lang.String filename)
Calls super constructor. |
|
ParsedProperties(java.lang.String[] pars)
Calls super constructor. |
|
| Method Summary | |
|---|---|
void |
load(java.lang.String fileName)
Loads given file. |
| Methods inherited from class peersim.config.ConfigProperties |
|---|
loadPropertyString, loadSystemResource |
| Methods inherited from class java.util.Properties |
|---|
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames |
| Methods inherited from class java.util.Hashtable |
|---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ParsedProperties(java.lang.String[] pars)
ConfigProperties.ConfigProperties(String[])
public ParsedProperties(java.lang.String filename)
throws java.io.IOException
java.io.IOExceptionConfigProperties.ConfigProperties(String)| Method Detail |
|---|
public void load(java.lang.String fileName)
throws java.io.IOException
Properties.load
with a file input stream to the given file, except that the file is parsed
the following way allowing to compress some property names
using { and }.
When a bracket is present, it must
be the only non-space element of a line. The last property defined
before the opening bracket define the prefix that is added to all the
properties defined included between brackets.
In other words, a construct like this:
control.degree GraphObserver
{
protocol newscast
undir
}
is equivalent to the definition of these three properties:
control.degree GraphObserver control.degree.protocol newscast control.degree.undirNested brackets are possible. The rule of the last property before the opening bracket applies also to the inside brackets, with the prefix being the complete property definition (so, including the prefix observed before). Example:
control.1 DynamicNetwork
{
add CRASH
substitute
init.0 WireKOut
{
degree DEGREE
protocol 0
}
}
defines the following properties:
control.1 DynamicNetwork
control.1.add CRASH
control.1.substitute
control.1.init.0 WireKOut
control.1.init.0.degree DEGREE
control.1.init.0.protocol 0
Know limitations: The parsing mechanism is very simple; no complex error messages are provided. In case of missing closing brackets, the method will stop reporting the number of missing brackets. Additional closing brackets (i.e., missing opening brackets) produce an error messages reporting the line where the closing bracket is present. Misplaced brackets (included in lines that contains other characters) are ignored, thus may indirectly produce the previous error messages.
load in class ConfigPropertiesjava.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||