public class ConfigurationUtil extends Object
Constructor and Description |
---|
ConfigurationUtil() |
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.
|
public static String loadConfigurationContents(File file) throws IOException
file
- the file to load fromIOException
- if the contents of the file could not be read due to an I/O problempublic static String loadConfigurationContents(String resourceName) throws IOException
resourceName
- the name of the resourceIOException
- if the resource could not be read due to an I/O problempublic static Properties loadConfigurationProperties(File file, Properties defaults) throws IOException
file
- the file to load fromdefaults
- default propertiesIOException
- if the contents of the file could not be read due to an I/O problempublic static Properties loadConfigurationProperties(String resourceName, Properties defaults) throws IOException
resourceName
- the name of the resourcedefaults
- default propertiesIOException
- if the resource could not be read due to an I/O problempublic static void saveConfigurationContents(String contents, File file) throws IOException
contents
- the configuration settingsfile
- the file to write toIOException
- if the settings could not be saved because of an I/O problempublic static void saveConfigurationProperties(Properties props, File file, boolean includeDefaults) throws IOException
props
- the configuration propertiesfile
- the file to write toincludeDefaults
- IOException
- if the settings could not be saved because of an I/O problemCopyright © 2015-2020 Eclipse Foundation. All Rights Reserved.