Class PropertyUtils


  • public class PropertyUtils
    extends java.lang.Object
    A collection of utility methods related to java.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 to Map<String, String> instance picking only string properties from the given java.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 using java.util.Properties.load(java.io.InputStream inStream) method and stores properties into a Map<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 using java.util.Properties.load(java.io.Reader reader) method and stores properties into a Map<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 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​(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 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 Detail

      • PropertyUtils

        public PropertyUtils()
    • 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 using java.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 using java.util.Properties.load(java.io.InputStream inStream) method and stores properties into a Map<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 using java.util.Properties.load(java.io.Reader reader) method and stores properties into a Map<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 using java.util.Properties.load(java.io.InputStream inStream) method and stores string properties into a SortedMap<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 to Map<String, String> instance picking only string properties from the given java.util.Properties instance.