fern.tools
Class ConfigReader

java.lang.Object
  extended by fern.tools.ConfigReader

public class ConfigReader
extends Object

Reads simple config files for test cases and makes the data of it accessible.

The file has to contain lines like
field=value

If a line starts with // or # it is ignored.

Author:
Florian Erhard

Constructor Summary
ConfigReader(String fn)
          Reads the given file and stores the data.
 
Method Summary
 double getAsDouble(String key)
          Gets the value of the line key=value as double
 int getAsInt(String key)
          Gets the value of the line key=value as int
 String getAsString(String key)
          Gets the value of the line key=value as string
 String[] getAsStringArr(String key)
          Gets the value of the line key=value as string array (the value is simply splitted by ,)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigReader

public ConfigReader(String fn)
             throws IOException
Reads the given file and stores the data.

Parameters:
fn - config file
Throws:
IOException
Method Detail

getAsString

public String getAsString(String key)
Gets the value of the line key=value as string

Parameters:
key - name of the field
Returns:
value

getAsStringArr

public String[] getAsStringArr(String key)
Gets the value of the line key=value as string array (the value is simply splitted by ,)

Parameters:
key - name of the field
Returns:
value

getAsDouble

public double getAsDouble(String key)
Gets the value of the line key=value as double

Parameters:
key - name of the field
Returns:
value

getAsInt

public int getAsInt(String key)
Gets the value of the line key=value as int

Parameters:
key - name of the field
Returns:
value