This class provides methods to read and parse configuration files and access configuration items.
More...
|
| | CryptoServerConfig (InputStream configStream) throws IOException |
| | Creates a CryptoServerConfig object from the given configuration stream. More...
|
| |
| | CryptoServerConfig (String fileName) throws IOException |
| | Creates a CryptoServerConfig object from the given configuration file. More...
|
| |
| boolean | exist (String key) |
| | Checks the existance of the given configuration item. More...
|
| |
| byte[] | getValue (String key, byte[] def) |
| | Returns the desired configuration value or a default value if the configuration item doesn't exist. More...
|
| |
| int | getInt (String key, int def) throws NumberFormatException |
| | Returns the desired configuration value or a default value if the configuration item doesn't exist. More...
|
| |
| boolean | getBoolean (String key, boolean def) throws NumberFormatException |
| | Returns the desired configuration value or a default value if the configuration item doesn't exist. More...
|
| |
| String | getString (String key, String def) |
| | Returns the desired configuration value or a default value if the configuration item doesn't exist. More...
|
| |
| String[] | getStringValues (String key, String[] def) |
| | Returns an array of configuration values. More...
|
| |
| void | add (String key, String value) |
| | Adds a configuration item to the configuration object. More...
|
| |
This class provides methods to read and parse configuration files and access configuration items.
Each line in a configuration file contains a keyword and one or more values.
Valid lines have to be structured according the scheme:
Optionally multiple values can be assigned to a key either separated by a space or tabulator:
<KEY> = <VALUE1> <VALUE2> <VALUE3>
or spread over multiple lines each ended by a backslash:
<KEY> = <VALUE1> \
<VALUE2> \
<VALUE3>
- Note
- Internally java.util.Properties is used to load and parse the configuration file.
- Example:
// retrieve integer value
int iValue = config.getInt("Counter", 0);
// retrieve single string
String label = config.getString("Label", null);
// retrieve boolean value
boolean switch = config.getBoolean("Switch", true);
This class provides methods to read and parse configuration files and access configuration items.
Definition: CryptoServerConfig.java:64
A sample configuration file looks like this:
# Sample configuration file
LogFile = C:/temp/CryptoServer.log
LogLevel = 2
LogSize = 1MB
# cluster
Device = PCI:0 \
192.168.4.1 192.168.4.2
# timeout on connection establishment
ConnectionTimeout = 3000
# command (read) timeout in milliseconds
Timeout = 60000