fc.util
Class FilePropertyMgr

java.lang.Object
  extended by fc.util.PropertyMgr
      extended by fc.util.FilePropertyMgr

public class FilePropertyMgr
extends PropertyMgr

Loads properties from a file. Trims whitespace from property values, in contrast to (Property does not trim whitespace from values, so "x = y " will return "y ", which is hard to debug).

ThreadSafety: This class is thread safe and can be used by multiple threads concurrently.

Version:
1.1 5/31/2002

Constructor Summary
FilePropertyMgr(File propertyFile)
           
 
Method Summary
 String get(String name)
          Returns the property associated with the specified key or null if the property was not found.
static void main(String[] args)
           
 void save()
          Saves any properties that were set previously.
 String set(String name, String value)
          Sets the property associated with the specified key.
 String toString()
          Returns a description but the exact details of said description are unspecified and subject to change.
 
Methods inherited from class fc.util.PropertyMgr
get, getBoolean, getInt, getRequired, getRequiredBoolean, getRequiredInt, setUsage
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilePropertyMgr

public FilePropertyMgr(File propertyFile)
                throws IOException
Throws:
IOException
Method Detail

get

public String get(String name)
Description copied from class: PropertyMgr
Returns the property associated with the specified key or null if the property was not found.

Specified by:
get in class PropertyMgr
Parameters:
name - the property key

set

public String set(String name,
                  String value)
Description copied from class: PropertyMgr
Sets the property associated with the specified key.

Specified by:
set in class PropertyMgr
Parameters:
name - the property key
value - the property value
Returns:
the previous value of the specified key or null if it did not have one.

save

public void save()
          throws IOException
Description copied from class: PropertyMgr
Saves any properties that were set previously. This method does not need to be called if properties were only read, however if any property was modified or added, it is essential to call this method to save any such changes.

Specified by:
save in class PropertyMgr
Throws:
IOException

toString

public String toString()
Returns a description but the exact details of said description are unspecified and subject to change. However, the following may be regarded as typical: [getClass().getName()] contains the following properties:
[List of properties]

Overrides:
toString in class Object

main

public static void main(String[] args)