Class AbstractPropertiesFactory<T extends Properties>
java.lang.Object
org.apache.commons.collections4.properties.AbstractPropertiesFactory<T>
- Type Parameters:
T
-Properties
or a subclass likeSortedProperties
.
- Direct Known Subclasses:
OrderedPropertiesFactory
,PropertiesFactory
,SortedPropertiesFactory
- Since:
- 4.4
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumerates property formats. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
Subclasses override to provide customized properties instances.Creates and loads properties from the given file.load
(InputStream inputStream) Creates and loads properties from the given input stream.load
(InputStream inputStream, AbstractPropertiesFactory.PropertyFormat propertyFormat) Creates and loads properties from the given input stream.Creates and loads properties from the given reader.load
(ClassLoader classLoader, String name) Creates and loads properties from the given file.Creates and loads properties from the given file name.Creates and loads properties from the given URI.Creates and loads properties from the given URL.Creates and loads properties from the given path.
-
Constructor Details
-
AbstractPropertiesFactory
protected AbstractPropertiesFactory()Constructs an instance.
-
-
Method Details
-
createProperties
Subclasses override to provide customized properties instances.- Returns:
- a new Properties instance.
-
load
Creates and loads properties from the given file.- Parameters:
classLoader
- the class loader to use to get the named resource.name
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
IOException
- Thrown if an error occurred reading the input stream.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
load
Creates and loads properties from the given file.- Parameters:
file
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
IOException
- Thrown if an error occurred reading the input stream.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.FileNotFoundException
- Thrown if the file does not exist, is a directory, or cannot be opened for reading.SecurityException
- Thrown if a security manager'scheckRead
method denies read access to the file.
-
load
Creates and loads properties from the given input stream.- Parameters:
inputStream
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
IOException
- Thrown if an error occurred reading the input stream.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
load
public T load(InputStream inputStream, AbstractPropertiesFactory.PropertyFormat propertyFormat) throws IOException Creates and loads properties from the given input stream.- Parameters:
inputStream
- the location of the properties file.propertyFormat
- The format of the given file.- Returns:
- a new properties object.
- Throws:
IOException
- Thrown if an error occurred reading the input stream.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.- Since:
- 4.5
-
load
Creates and loads properties from the given path.- Parameters:
path
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
IOException
- Thrown if an error occurred reading the input stream.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
load
Creates and loads properties from the given reader.- Parameters:
reader
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
IOException
- Thrown if an error occurred reading the input stream.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
load
Creates and loads properties from the given file name.- Parameters:
name
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
IOException
- Thrown if an error occurred reading the input stream.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
load
Creates and loads properties from the given URI.- Parameters:
uri
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
IOException
- Thrown if an error occurred reading the input stream.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
load
Creates and loads properties from the given URL.- Parameters:
url
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
IOException
- Thrown if an error occurred reading the input stream.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-