Package org.h2.util

Class SortedProperties

All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class SortedProperties extends Properties
Sorted properties file. This implementation requires that store() internally calls keys().
See Also:
  • Field Details

  • Constructor Details

    • SortedProperties

      public SortedProperties()
  • Method Details

    • keys

      public Enumeration<Object> keys()
      Overrides:
      keys in class Properties
    • getBooleanProperty

      public static boolean getBooleanProperty(Properties prop, String key, boolean def)
      Get a boolean property value from a properties object.
      Parameters:
      prop - the properties object
      key - the key
      def - the default value
      Returns:
      the value if set, or the default value if not
    • getIntProperty

      public static int getIntProperty(Properties prop, String key, int def)
      Get an int property value from a properties object.
      Parameters:
      prop - the properties object
      key - the key
      def - the default value
      Returns:
      the value if set, or the default value if not
    • getStringProperty

      public static String getStringProperty(Properties prop, String key, String def)
      Get a string property value from a properties object.
      Parameters:
      prop - the properties object
      key - the key
      def - the default value
      Returns:
      the value if set, or the default value if not
    • loadProperties

      public static SortedProperties loadProperties(String fileName) throws IOException
      Load a properties object from a file.
      Parameters:
      fileName - the name of the properties file
      Returns:
      the properties object
      Throws:
      IOException - on failure
    • store

      public void store(String fileName) throws IOException
      Store a properties file. The header and the date is not written.
      Parameters:
      fileName - the target file name
      Throws:
      IOException - on failure
    • toLines

      public String toLines()
      Convert the map to a list of line in the form key=value.
      Returns:
      the lines
    • fromLines

      public static SortedProperties fromLines(String s)
      Convert a String to a map.
      Parameters:
      s - the string
      Returns:
      the map