Class Configuration

java.lang.Object
  |
  +--Configuration

public class Configuration
extends java.lang.Object

The configuration class is used to load configuration data for programs. The format is a simple key/value separated by whitespace, the third column is not used by the program can be notes to increase the readability. Lines beginning with a # are comments.:

 #key			value			Comments
 PasswordFile	password.dat	name of password file
 LogFile			log.dat
 MaxLogSize		5000			Max number of lines in the log file
 

Version:
1.0
Author:
Paul Regenhardt

Constructor Summary
Configuration(java.lang.String fName)
          This is the constructor for applications and it takes a file name.
Configuration(java.net.URL codebase)
          This constructor is used with applets to load the config file from an HTTP server.
 
Method Summary
 java.lang.String get(java.lang.String key)
          Passing in the key will return the resultant value.
 int getInt(java.lang.String key)
          Passing in the first column value will return the second column value as an integer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration(java.lang.String fName)
This is the constructor for applications and it takes a file name.
Parameters:
fName - Name of the file to read as the configuration

Configuration

public Configuration(java.net.URL codebase)
This constructor is used with applets to load the config file from an HTTP server.
Parameters:
codebase - The URL to the configuration file.
Method Detail

get

public java.lang.String get(java.lang.String key)
Passing in the key will return the resultant value. If no matching key is found null is returned.
Parameters:
key - The first column in the file
Returns:
The matching second column value

getInt

public int getInt(java.lang.String key)
Passing in the first column value will return the second column value as an integer.
Parameters:
key - the first column value
Returns:
the second column value as an int