org.entityfs.util.properties
Class PropertiesUtil

java.lang.Object
  extended by org.entityfs.util.properties.PropertiesUtil

public final class PropertiesUtil
extends Object

Utility class with static methods for working with Properties objects.

Since:
1.0
Author:
Karl Gustafsson

Method Summary
static Properties loadFromFile(ReadableFile f)
          Load a Properties object from the supplied file.
static void saveToFile(Properties p, WritableFile f)
          Save the Properties object to the supplied file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadFromFile

public static Properties loadFromFile(ReadableFile f)
                               throws WrappedIOException
Load a Properties object from the supplied file. The properties object is not backed by the file, so changes made to the properties will not automatically be saved in the file. To have a Properties object that can store its state back to the property file it was loaded from, use a StorableProperties implementation instead.

Properties may be appended to an existing Properties object by using the Map.putAll(java.util.Map) method.

The file is locked for reading by this method while it is executing.

Parameters:
f - The file.
Returns:
A Properties object with the contents of the file as properties.
Throws:
WrappedIOException - On errors when loading the property file.
See Also:
saveToFile(Properties, WritableFile)

saveToFile

public static void saveToFile(Properties p,
                              WritableFile f)
                       throws WrappedIOException
Save the Properties object to the supplied file. The previous contents of the file will be discarded.

The file is locked for writing by this method while it is executing.

Parameters:
p - The properties object.
f - The file to save the properties to.
Throws:
WrappedIOException
See Also:
loadFromFile(ReadableFile)