org.iu.gps
Class Config

java.lang.Object
  |
  +--org.iu.gps.Config

public class Config
extends java.lang.Object

Various methods for storing/loading Java objects from ASCII-readable configuration files.

Author:
walther

Field Summary
static java.lang.String CONFIG_PATH
          Root path for configuration files.
 
Constructor Summary
Config()
           
 
Method Summary
static void convert(java.lang.String s, java.lang.Object result, java.lang.reflect.Field f)
          Converts string representation into type of given field, stores in given object.
static java.lang.String getConfigFilename(java.lang.String name)
          Gets the name of a configuration file, according to the defined CONFIG_PATH.
static java.lang.String getConfigPath()
           
static void loadObject(java.io.InputStream is, java.lang.Object o)
          Load object from input stream.
static void loadObject(java.lang.String file, java.lang.Object o)
          Load object from file with given name.
static void main(java.lang.String[] arg)
          The main program for the Config class.
static void saveObject(java.io.OutputStream os, java.lang.Object o)
          Save object in output stream.
static void saveObject(java.lang.String file, java.lang.Object o)
          Save object in file with given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_PATH

public static final java.lang.String CONFIG_PATH
Root path for configuration files.

See Also:
Constant Field Values
Constructor Detail

Config

public Config()
Method Detail

getConfigFilename

public static java.lang.String getConfigFilename(java.lang.String name)
Gets the name of a configuration file, according to the defined CONFIG_PATH.

Parameters:
name - Parameter
Returns:
The configFilename value

getConfigPath

public static java.lang.String getConfigPath()

convert

public static void convert(java.lang.String s,
                           java.lang.Object result,
                           java.lang.reflect.Field f)
Converts string representation into type of given field, stores in given object.

Parameters:
s - Parameter
result - Parameter
f - Parameter

saveObject

public static void saveObject(java.io.OutputStream os,
                              java.lang.Object o)
                       throws java.lang.Exception
Save object in output stream.

Parameters:
os - Parameter
o - Parameter
Throws:
java.lang.Exception - Exception

saveObject

public static void saveObject(java.lang.String file,
                              java.lang.Object o)
                       throws java.lang.Exception
Save object in file with given name.

Parameters:
file - Parameter
o - Parameter
Throws:
java.lang.Exception - Exception

loadObject

public static void loadObject(java.io.InputStream is,
                              java.lang.Object o)
                       throws java.lang.Exception
Load object from input stream.

Parameters:
is - Parameter
o - Parameter
Throws:
java.lang.Exception - Exception

loadObject

public static void loadObject(java.lang.String file,
                              java.lang.Object o)
                       throws java.lang.Exception
Load object from file with given name.

Parameters:
file - Parameter
o - Parameter
Throws:
java.lang.Exception - Exception

main

public static void main(java.lang.String[] arg)
                 throws java.lang.Exception
The main program for the Config class. Stores a GPSInfo object in file "test.dat", then reloads object from that file.

Parameters:
arg - The command line arguments
Throws:
java.lang.Exception - Exception


Copyright © 2000-2002 Ulrich Walther. All Rights Reserved.