|
||||||||||
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 java.lang.String |
getProperty(java.util.Properties props,
java.lang.String key,
java.lang.String def)
Return the value of a property. |
static java.lang.String[] |
readListFile(java.net.URL listFile)
Read a file and return the list of lines in an array of strings. |
static java.util.Properties |
readProperties(java.io.InputStream stream,
java.util.Properties mappings,
boolean closeStream)
Read a set of properties from a property file provided as an Inputstream. |
static java.util.Properties |
readProps(java.net.URL propsUrl,
java.util.Properties mappings)
Read a set of properties from a property file specificed by a url. |
static java.lang.String |
resolveProperty(java.util.Properties props,
java.lang.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 java.util.Properties readProps(java.net.URL propsUrl, java.util.Properties mappings) throws java.io.IOException
propsUrl
- the url of the property file to readmappings
- Properties that will be available for translations initially.
java.io.IOException
- if an io error occursreadProperties(java.io.InputStream,java.util.Properties,boolean)
public static java.util.Properties readProperties(java.io.InputStream stream, java.util.Properties mappings, boolean closeStream) throws java.io.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.
java.io.IOException
- if an io error occurspublic static java.lang.String resolveProperty(java.util.Properties props, java.lang.String value)
props
- a set of know propertiesvalue
- the string to parse for tokens
public static java.lang.String getProperty(java.util.Properties props, java.lang.String key, java.lang.String def)
props
- the property filekey
- the property key to lookupdef
- the default value
public static java.lang.String[] readListFile(java.net.URL listFile) throws java.io.IOException
listFile
- the url to read from
java.io.IOException
- if a read error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |