com.compoze.util
Class FileProperties
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--java.util.Properties
|
+--com.compoze.util.ObjectProperties
|
+--com.compoze.util.MutableProperties
|
+--com.compoze.util.FileProperties
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable
- public class FileProperties
- extends MutableProperties
- implements java.io.Serializable
A Properties object that gets its Properties from a file. It checks on the
fly to see if the file has been modified to re-read the Properties.
- See Also:
Properties
, Serialized Form
Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
Fields inherited from class java.util.Properties |
defaults |
Constructor Summary |
FileProperties(java.io.File propsFile)
Constructor. |
FileProperties(java.io.File propsFile,
long lPropsFileCheckInterval)
Constructor. |
FileProperties(java.io.File propsFile,
long lPropsFileCheckInterval,
java.util.Properties defaults)
Constructor. |
FileProperties(java.io.File propsFile,
java.util.Properties defaults)
Constructor. |
Method Summary |
java.lang.String |
getProperty(java.lang.String sKey)
Get a property. |
java.lang.String |
getProperty(java.lang.String sKey,
java.lang.String sDefaultValue)
Get a property. |
void |
list(java.io.PrintStream out)
Prints this property list out to the specified output stream. |
void |
list(java.io.PrintWriter writer)
Prints this property list out to the specified output stream. |
static void |
main(java.lang.String[] args)
Exerciser. |
java.util.Enumeration |
propertyNames()
Get an Enumeration of the property names. |
void |
refresh()
Force a re-load of the properties. |
void |
setCheckInterval(long lCheckInterval)
Set the check for updates interval for the file. |
Methods inherited from class com.compoze.util.ObjectProperties |
getBoolean, getBoolean, getByte, getByte, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getShort, getShort, getString, getString, getStringArray, getStringArray, getStringArray, replaceSubstitutions |
Methods inherited from class java.util.Properties |
load, save, setProperty, store |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
DEFAULT_CHECK_INTERVAL
protected static final int DEFAULT_CHECK_INTERVAL
FileProperties
public FileProperties(java.io.File propsFile,
long lPropsFileCheckInterval)
- Constructor.
- Parameters:
propsFile
- the file from which the Properties are readlPropsFileCheckInterval
- a checking interval (in milliseconds) for the file
FileProperties
public FileProperties(java.io.File propsFile,
long lPropsFileCheckInterval,
java.util.Properties defaults)
- Constructor.
- Parameters:
propsFile
- the file from which the Properties are readlPropsFileCheckInterval
- a checking interval (in milliseconds) for the filedefaults
- a list of defaults used when a Property is not found
FileProperties
public FileProperties(java.io.File propsFile)
- Constructor.
- Parameters:
propsFile
- the file from which the Properties are read
FileProperties
public FileProperties(java.io.File propsFile,
java.util.Properties defaults)
- Constructor.
- Parameters:
propsFile
- the file from which the Properties are readdefaults
- a list of defaults used when a Property is not found
setCheckInterval
public void setCheckInterval(long lCheckInterval)
- Set the check for updates interval for the file. The properties file will not
be checked more than once during the specified interval.
- Parameters:
lCheckInterval
- interval to check (in milliseconds)
getProperty
public java.lang.String getProperty(java.lang.String sKey)
- Get a property.
- Overrides:
getProperty
in class MutableProperties
- Parameters:
sKey
- the key to get the property for
getProperty
public java.lang.String getProperty(java.lang.String sKey,
java.lang.String sDefaultValue)
- Get a property.
- Overrides:
getProperty
in class MutableProperties
- Parameters:
sKey
- the key to get the property forsDefaultValue
- the default value in case the key is not found
list
public void list(java.io.PrintStream out)
- Prints this property list out to the specified output stream. This method
is useful for debugging.
- Overrides:
list
in class java.util.Properties
- Parameters:
out
- the PrintStream to write to
list
public void list(java.io.PrintWriter writer)
- Prints this property list out to the specified output stream. This method
is useful for debugging.
- Overrides:
list
in class java.util.Properties
- Parameters:
writer
- the Writer to write to
propertyNames
public java.util.Enumeration propertyNames()
- Get an Enumeration of the property names.
- Overrides:
propertyNames
in class MutableProperties
- Returns:
- an enumeration of all the keys in this property list, including
the keys in the default property list
refresh
public void refresh()
- Force a re-load of the properties.
main
public static void main(java.lang.String[] args)
- Exerciser.
- Parameters:
args
- arguments - first is properties file and each
additional is a key
Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.