Class PropertiesUtils


  • public final class PropertiesUtils
    extends java.lang.Object
    some useful methods for properties
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String saveConvert​(java.lang.String string, boolean encodeWhiteSpace)
      Encodes a property file string from a supplied key/value line.
      static java.lang.String toLine​(java.lang.String key, java.lang.String value)
      Generates a property file line from a supplied key and value.
      static java.lang.String toSortedString​(java.util.Properties properties)
      like Properties.store, but stores the properties in sorted order
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toSortedString

        public static java.lang.String toSortedString​(java.util.Properties properties)

        like Properties.store, but stores the properties in sorted order

        Parameters:
        properties - the properties object
        Returns:
        String the properties, nicely formatted
      • toLine

        public static java.lang.String toLine​(java.lang.String key,
                                              java.lang.String value)
        Generates a property file line from a supplied key and value.
        Parameters:
        key - the property's key
        value - the property's value
        Returns:
        the converted string
      • saveConvert

        public static java.lang.String saveConvert​(java.lang.String string,
                                                   boolean encodeWhiteSpace)
        Encodes a property file string from a supplied key/value line.
        Parameters:
        string - the string to encode
        encodeWhiteSpace - true if whitespace should be encoded also
        Returns:
        the converted string