Class PropertyUtils

java.lang.Object
com.sun.javatest.util.PropertyUtils

public class PropertyUtils extends Object
A collection of utility methods related to java.util.Properties loading, saving and transformation.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Map<String,String>
    Converts the given properties to Map<String, String> instance picking only string properties from the given java.util.Properties instance.
    static Map<String,String>
    load(InputStream inputStream)
    Reads a property list from the given input stream using java.util.Properties.load(java.io.InputStream inStream) method and stores properties into a Map<String, String> that is returned.
    static Map<String,String>
    load(Reader reader)
    Reads a property list with the given reader using java.util.Properties.load(java.io.Reader reader) method and stores properties into a Map<String, String> that is returned.
    loadSorted(InputStream inputStream)
    Reads a property list from the given input stream using java.util.Properties.load(java.io.InputStream inStream) method and stores string properties into a SortedMap<String, String> that is returned.
    static void
    store(Map<String,String> stringProps, OutputStream out, String comments)
    Utility method that writes the given map of strings to the given output stream with provided comments using java.util.Properties.store(java.io.OutputStream, String) method.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PropertyUtils

      public PropertyUtils()
  • Method Details

    • store

      public static void store(Map<String,String> stringProps, OutputStream out, String comments) throws IOException
      Utility method that writes the given map of strings to the given output stream with provided comments using java.util.Properties.store(java.io.OutputStream, String) method.
      Throws:
      IOException
    • load

      public static Map<String,String> load(InputStream inputStream) throws IOException
      Reads a property list from the given input stream using java.util.Properties.load(java.io.InputStream inStream) method and stores properties into a Map<String, String> that is returned.
      Throws:
      IOException
    • load

      public static Map<String,String> load(Reader reader) throws IOException
      Reads a property list with the given reader using java.util.Properties.load(java.io.Reader reader) method and stores properties into a Map<String, String> that is returned.
      Throws:
      IOException
    • loadSorted

      public static SortedMap<String,String> loadSorted(InputStream inputStream) throws IOException
      Reads a property list from the given input stream using java.util.Properties.load(java.io.InputStream inStream) method and stores string properties into a SortedMap<String, String> that is returned.
      Throws:
      IOException
    • convertToStringProps

      public static Map<String,String> convertToStringProps(Properties properties)
      Converts the given properties to Map<String, String> instance picking only string properties from the given java.util.Properties instance.