|
SourceForge Jpcap | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jpcap.util.PropertyHelper
public class PropertyHelper
Property helper utility methods.
Constructor Summary | |
---|---|
PropertyHelper()
|
Method Summary | |
---|---|
static boolean |
getBooleanProperty(Properties properties,
Object key)
Read the specified boolean property. |
static Color |
getColorProperty(Properties properties,
Object key)
Convert a space delimited color tuple string to a color. |
static float |
getFloatProperty(Properties properties,
Object key)
Read the specified float property. |
static int |
getIntProperty(Properties properties,
Object key)
Read the specified integer property. |
static int |
getIpProperty(Properties properties,
Object key)
Convert a dot-delimited IP address to an integer. |
static Properties |
load(String[] paths,
String fileName)
Load the specified properties file from one of the specified set of paths. |
static Properties |
refresh(String name,
InputStream in)
Refresh property settings from an input stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertyHelper()
Method Detail |
---|
public static float getFloatProperty(Properties properties, Object key)
Throws an exception if the property value isn't a floating-point number.
key
- the name of the property
public static int getIntProperty(Properties properties, Object key)
Throws an exception if the property value isn't an integer.
key
- the name of the property
public static Color getColorProperty(Properties properties, Object key)
Converts a string value like "255 255 0" to a color constant, in this case, yellow.
key
- the name of the property
public static int getIpProperty(Properties properties, Object key)
Converts a string value like "10.0.0.5" to an integer.
key
- the name of the property
public static boolean getBooleanProperty(Properties properties, Object key)
Returns false if the property doesn't exist or can't be converted to a boolean.
key
- the name of the property
public static Properties refresh(String name, InputStream in) throws IOException
name
- Property file namein
- Input stream
IOException
- I/O problempublic static Properties load(String[] paths, String fileName)
paths
- array of String containing target paths.fileName
- the name of the property file.
|
Copyright © Patrick Charles & Jonas Lehmann, 2001; Esmond Pitt, 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |