Package com.sun.javatest.util
Class PropertyUtils
- java.lang.Object
-
- com.sun.javatest.util.PropertyUtils
-
public class PropertyUtils extends java.lang.Object
A collection of utility methods related tojava.util.Properties
loading, saving and transformation.
-
-
Constructor Summary
Constructors Constructor Description PropertyUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.String>
convertToStringProps(java.util.Properties properties)
Converts the given properties toMap<String, String>
instance picking only string properties from the givenjava.util.Properties
instance.static java.util.Map<java.lang.String,java.lang.String>
load(java.io.InputStream inputStream)
Reads a property list from the given input stream usingjava.util.Properties.load(java.io.InputStream inStream)
method and stores properties into aMap<String, String>
that is returned.static java.util.Map<java.lang.String,java.lang.String>
load(java.io.Reader reader)
Reads a property list with the given reader usingjava.util.Properties.load(java.io.Reader reader)
method and stores properties into aMap<String, String>
that is returned.static java.util.SortedMap<java.lang.String,java.lang.String>
loadSorted(java.io.InputStream inputStream)
Reads a property list from the given input stream usingjava.util.Properties.load(java.io.InputStream inStream)
method and stores string properties into aSortedMap<String, String>
that is returned.static void
store(java.util.Map<java.lang.String,java.lang.String> stringProps, java.io.OutputStream out, java.lang.String comments)
Utility method that writes the given map of strings to the given output stream with provided comments usingjava.util.Properties.store(java.io.OutputStream, String)
method.
-
-
-
Method Detail
-
store
public static void store(java.util.Map<java.lang.String,java.lang.String> stringProps, java.io.OutputStream out, java.lang.String comments) throws java.io.IOException
Utility method that writes the given map of strings to the given output stream with provided comments usingjava.util.Properties.store(java.io.OutputStream, String)
method.- Throws:
java.io.IOException
-
load
public static java.util.Map<java.lang.String,java.lang.String> load(java.io.InputStream inputStream) throws java.io.IOException
Reads a property list from the given input stream usingjava.util.Properties.load(java.io.InputStream inStream)
method and stores properties into aMap<String, String>
that is returned.- Throws:
java.io.IOException
-
load
public static java.util.Map<java.lang.String,java.lang.String> load(java.io.Reader reader) throws java.io.IOException
Reads a property list with the given reader usingjava.util.Properties.load(java.io.Reader reader)
method and stores properties into aMap<String, String>
that is returned.- Throws:
java.io.IOException
-
loadSorted
public static java.util.SortedMap<java.lang.String,java.lang.String> loadSorted(java.io.InputStream inputStream) throws java.io.IOException
Reads a property list from the given input stream usingjava.util.Properties.load(java.io.InputStream inStream)
method and stores string properties into aSortedMap<String, String>
that is returned.- Throws:
java.io.IOException
-
convertToStringProps
public static java.util.Map<java.lang.String,java.lang.String> convertToStringProps(java.util.Properties properties)
Converts the given properties toMap<String, String>
instance picking only string properties from the givenjava.util.Properties
instance.
-
-