Class ConfigFileUtils


  • public class ConfigFileUtils
    extends Object
    • Constructor Detail

      • ConfigFileUtils

        public ConfigFileUtils()
    • Method Detail

      • parseConfigFile

        public static Map<String,​String> parseConfigFile​(File configFile)
                                                        throws IOException
        Parses the contents of a .properties or .ini file into a map.
        Parameters:
        configFile - The file to read.
        Returns:
        The key-value pairs contained in the file, ignoring any comments or blank lines.
        Throws:
        IOException - If the file could not be read or an unsupported file extension is used.
      • writeConfigFile

        public static void writeConfigFile​(File configFile,
                                           Map<String,​String> values)
                                    throws IOException
        Write the configuration values dependent of the file extension. Currently supported are .properties and .ini files.
        Parameters:
        configFile - the destination config file.
        values - configuration key-value-pairs to write.
        Throws:
        IOException - If the file could not be written or an unsupported file extension is used.