org.ala.layers.intersect
Class IniReader
java.lang.Object
org.ala.layers.intersect.IniReader
public class IniReader
- extends java.lang.Object
Provides read only access to an ini file.
File format expected is:
[section_name]
key_name=key_value
where key_values are able to be returned when a
section_name and key_name are provided.
Errors and absences result in default values returned
from get functions.
- Author:
- Adam Collins
|
Field Summary |
protected org.apache.log4j.Logger |
logger
Log4j instance |
|
Constructor Summary |
IniReader(java.lang.String filename)
Constructor loads ini file into the document object. |
|
Method Summary |
double |
getDoubleValue(java.lang.String section,
java.lang.String key)
|
int |
getIntegerValue(java.lang.String section,
java.lang.String key)
|
java.lang.String |
getStringValue(java.lang.String section,
java.lang.String key)
|
void |
setValue(java.lang.String section,
java.lang.String key,
java.lang.String value)
|
boolean |
valueExists(java.lang.String section,
java.lang.String key)
|
void |
write(java.util.Map<java.lang.String,java.lang.String> doc,
java.lang.String filename)
|
void |
write(java.lang.String filename)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected org.apache.log4j.Logger logger
- Log4j instance
IniReader
public IniReader(java.lang.String filename)
- Constructor loads ini file into the document object.
Any errors or failure will log an error only.
- Parameters:
filename - ini file to load
getStringValue
public java.lang.String getStringValue(java.lang.String section,
java.lang.String key)
- Parameters:
section - section name as Stringkey - key name as String
- Returns:
- value of key as String
empty string when key is not found
getIntegerValue
public int getIntegerValue(java.lang.String section,
java.lang.String key)
- Parameters:
section - section name as Stringkey - key name as String
- Returns:
- value of key as int
0 when key is not found
getDoubleValue
public double getDoubleValue(java.lang.String section,
java.lang.String key)
- Parameters:
section - section name as Stringkey - key name as String
- Returns:
- value of key as double
0 when key is not found
valueExists
public boolean valueExists(java.lang.String section,
java.lang.String key)
- Parameters:
section - key -
- Returns:
- true if value was loaded from the ini file
false if the value was not loaded from the ini file
setValue
public void setValue(java.lang.String section,
java.lang.String key,
java.lang.String value)
write
public void write(java.lang.String filename)
write
public void write(java.util.Map<java.lang.String,java.lang.String> doc,
java.lang.String filename)
Copyright © 2014. All Rights Reserved.