public abstract class PropertiesLoaderUtils extends Object
java.util.Properties,
performing standard handling of input streams.
For more configurable properties loading, including the option of a customized encoding, consider using the PropertiesLoaderSupport class.
PropertiesLoaderSupport| Constructor and Description |
|---|
PropertiesLoaderUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
fillProperties(Properties props,
EncodedResource resource)
Fill the given properties from the given EncodedResource,
potentially defining a specific encoding for the properties file.
|
static void |
fillProperties(Properties props,
Resource resource)
Fill the given properties from the given resource (in ISO-8859-1 encoding).
|
static Properties |
loadAllProperties(String resourceName)
Load all properties from the specified class path resource
(in ISO-8859-1 encoding), using the default class loader.
|
static Properties |
loadAllProperties(String resourceName,
ClassLoader classLoader)
Load all properties from the specified class path resource
(in ISO-8859-1 encoding), using the given class loader.
|
static Properties |
loadProperties(EncodedResource resource)
Load properties from the given EncodedResource,
potentially defining a specific encoding for the properties file.
|
static Properties |
loadProperties(Resource resource)
Load properties from the given resource (in ISO-8859-1 encoding).
|
public static Properties loadProperties(EncodedResource resource) throws IOException
IOExceptionfillProperties(java.util.Properties, EncodedResource)public static void fillProperties(Properties props, EncodedResource resource) throws IOException
props - the Properties instance to load intoresource - the resource to load fromIOException - in case of I/O errorspublic static Properties loadProperties(Resource resource) throws IOException
resource - the resource to load fromIOException - if loading failedfillProperties(java.util.Properties, Resource)public static void fillProperties(Properties props, Resource resource) throws IOException
props - the Properties instance to fillresource - the resource to load fromIOException - if loading failedpublic static Properties loadAllProperties(String resourceName) throws IOException
Merges properties if more than one resource of the same name found in the class path.
resourceName - the name of the class path resourceIOException - if loading failedpublic static Properties loadAllProperties(String resourceName, ClassLoader classLoader) throws IOException
Merges properties if more than one resource of the same name found in the class path.
resourceName - the name of the class path resourceclassLoader - the ClassLoader to use for loading
(or null to use the default class loader)IOException - if loading failed