public abstract class PropertiesLoaderUtils
extends java.lang.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
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
XML_FILE_EXTENSION |
Constructor and Description |
---|
PropertiesLoaderUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
fillProperties(java.util.Properties props,
EncodedResource resource)
Fill the given properties from the given EncodedResource,
potentially defining a specific encoding for the properties file.
|
(package private) static void |
fillProperties(java.util.Properties props,
EncodedResource resource,
PropertiesPersister persister)
Actually load properties from the given EncodedResource into the given Properties instance.
|
static void |
fillProperties(java.util.Properties props,
Resource resource)
Fill the given properties from the given resource (in ISO-8859-1 encoding).
|
static java.util.Properties |
loadAllProperties(java.lang.String resourceName)
Load all properties from the specified class path resource
(in ISO-8859-1 encoding), using the default class loader.
|
static java.util.Properties |
loadAllProperties(java.lang.String resourceName,
java.lang.ClassLoader classLoader)
Load all properties from the specified class path resource
(in ISO-8859-1 encoding), using the given class loader.
|
static java.util.Properties |
loadProperties(EncodedResource resource)
Load properties from the given EncodedResource,
potentially defining a specific encoding for the properties file.
|
static java.util.Properties |
loadProperties(Resource resource)
Load properties from the given resource (in ISO-8859-1 encoding).
|
private static final java.lang.String XML_FILE_EXTENSION
public static java.util.Properties loadProperties(EncodedResource resource) throws java.io.IOException
java.io.IOException
fillProperties(java.util.Properties, EncodedResource)
public static void fillProperties(java.util.Properties props, EncodedResource resource) throws java.io.IOException
props
- the Properties instance to load intoresource
- the resource to load fromjava.io.IOException
- in case of I/O errorsstatic void fillProperties(java.util.Properties props, EncodedResource resource, PropertiesPersister persister) throws java.io.IOException
props
- the Properties instance to load intoresource
- the resource to load frompersister
- the PropertiesPersister to usejava.io.IOException
- in case of I/O errorspublic static java.util.Properties loadProperties(Resource resource) throws java.io.IOException
resource
- the resource to load fromjava.io.IOException
- if loading failedfillProperties(java.util.Properties, Resource)
public static void fillProperties(java.util.Properties props, Resource resource) throws java.io.IOException
props
- the Properties instance to fillresource
- the resource to load fromjava.io.IOException
- if loading failedpublic static java.util.Properties loadAllProperties(java.lang.String resourceName) throws java.io.IOException
Merges properties if more than one resource of the same name found in the class path.
resourceName
- the name of the class path resourcejava.io.IOException
- if loading failedpublic static java.util.Properties loadAllProperties(java.lang.String resourceName, java.lang.ClassLoader classLoader) throws java.io.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)java.io.IOException
- if loading failed