|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ops4j.util.collections.PropertiesUtils
public final class PropertiesUtils
Utility class supporting operations related to property retrival.
| Method Summary | |
|---|---|
static String |
getProperty(Properties props,
String key,
String def)
Return the value of a property. |
static String[] |
readListFile(URL listFile)
Read a file and return the list of lines in an array of strings. |
static Properties |
readProperties(InputStream stream,
Properties mappings,
boolean closeStream)
Read a set of properties from a property file provided as an Inputstream. |
static Properties |
readProps(URL propsUrl,
Properties mappings)
Read a set of properties from a property file specificed by a url. |
static String |
resolveProperty(Properties props,
String value)
Resolve symbols in a supplied value against supplied known properties. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Properties readProps(URL propsUrl,
Properties mappings)
throws IOException
propsUrl - the url of the property file to readmappings - Properties that will be available for translations initially.
IOException - if an io error occursreadProperties(java.io.InputStream,java.util.Properties,boolean)
public static Properties readProperties(InputStream stream,
Properties mappings,
boolean closeStream)
throws IOException
mappings properties as well as all values within the Properties that are being read.
Example;
Properties mappings = System.getProperties();
Properties myProps = PropertiesUtils.readProperties( "mine.properties", mappings );
and the "mine.properties" file contains;
mything=${myplace}/mything
myplace=${user.home}/myplace
then the Properties object myProps will contain;
mything=/home/niclas/myplace/mything
myplace=/home/niclas/myplace
stream - the InputStream of the property file to read.mappings - Properties that will be available for translations initially.closeStream - true if the method should close the stream before returning, false otherwise.
IOException - if an io error occurs
public static String resolveProperty(Properties props,
String value)
props - a set of know propertiesvalue - the string to parse for tokens
public static String getProperty(Properties props,
String key,
String def)
props - the property filekey - the property key to lookupdef - the default value
public static String[] readListFile(URL listFile)
throws IOException
listFile - the url to read from
IOException - if a read error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||