org.eclipse.rdf4j.common.app.util

## Class ConfigurationUtil

- java.lang.Object
- - org.eclipse.rdf4j.common.app.util.ConfigurationUtil

-     public class ConfigurationUtil
      extends Object

  Configuration helper class

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConfigurationUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `loadConfigurationContents(File file)` Load configuration settings from the specified file.
    `static String` | `loadConfigurationContents(String resourceName)` Load configuration settings from a resource on the classpath.
    `static Properties` | `loadConfigurationProperties(File file, Properties defaults)` Load configuration properties from the specified file.
    `static Properties` | `loadConfigurationProperties(String resourceName, Properties defaults)` Load configuration properties from a resource on the classpath.
    `static void` | `saveConfigurationContents(String contents, File file)` Save configuration settings to a file.
    `static void` | `saveConfigurationProperties(Properties props, File file, boolean includeDefaults)` Save configuration properties to a file.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ConfigurationUtil

          public ConfigurationUtil()

  - ### Method Detail

    - #### loadConfigurationContents

          public static String loadConfigurationContents(File file)
                                                  throws IOException

      Load configuration settings from the specified file.
      Parameters:
        `file` - the file to load from
      Returns:
        the contents of the file as a String, or null if the file did not exist
      Throws:
        `IOException` - if the contents of the file could not be read due to an I/O problem

    - #### loadConfigurationContents

          public static String loadConfigurationContents(String resourceName)
                                                  throws IOException

      Load configuration settings from a resource on the classpath.
      Parameters:
        `resourceName` - the name of the resource
      Returns:
        the contents of the resources as a String, or null if the resource, nor its default, could be found
      Throws:
        `IOException` - if the resource could not be read due to an I/O problem

    - #### loadConfigurationProperties

          public static Properties loadConfigurationProperties(File file,
                                                               Properties defaults)
                                                        throws IOException

      Load configuration properties from the specified file.
      Parameters:
        `file` - the file to load from
        `defaults` - default properties
      Returns:
        the contents of the file as Properties, or null if the file did not exist
      Throws:
        `IOException` - if the contents of the file could not be read due to an I/O problem

    - #### loadConfigurationProperties

          public static Properties loadConfigurationProperties(String resourceName,
                                                               Properties defaults)
                                                        throws IOException

      Load configuration properties from a resource on the classpath.
      Parameters:
        `resourceName` - the name of the resource
        `defaults` - default properties
      Returns:
        the contents of the resource as Properties
      Throws:
        `IOException` - if the resource could not be read due to an I/O problem

    - #### saveConfigurationContents

          public static void saveConfigurationContents(String contents,
                                                       File file)
                                                throws IOException

      Save configuration settings to a file.
      Parameters:
        `contents` - the configuration settings
        `file` - the file to write to
      Throws:
        `IOException` - if the settings could not be saved because of an I/O problem

    - #### saveConfigurationProperties

          public static void saveConfigurationProperties(Properties props,
                                                         File file,
                                                         boolean includeDefaults)
                                                  throws IOException

      Save configuration properties to a file.
      Parameters:
        `props` - the configuration properties
        `file` - the file to write to
        `includeDefaults` -
      Throws:
        `IOException` - if the settings could not be saved because of an I/O problem

Copyright © 2015-2021 Eclipse Foundation. All Rights Reserved.