Class AbstractPropertiesFactory<T extends java.util.Properties>
- java.lang.Object
-
- org.apache.commons.collections4.properties.AbstractPropertiesFactory<T>
-
- Type Parameters:
T
-Properties
or a subclass likeSortedProperties
.
- Direct Known Subclasses:
PropertiesFactory
,SortedPropertiesFactory
public abstract class AbstractPropertiesFactory<T extends java.util.Properties> extends java.lang.Object
- Since:
- 4.4
- See Also:
Properties
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
load(java.io.File file)
Creates and loads properties from the given file.T
load(java.io.InputStream inputStream)
Creates and loads properties from the given input stream.T
load(java.io.Reader reader)
Creates and loads properties from the given reader.T
load(java.lang.ClassLoader classLoader, java.lang.String name)
Creates and loads properties from the given file.T
load(java.lang.String name)
Creates and loads properties from the given file name.T
load(java.net.URI uri)
Creates and loads properties from the given URI.T
load(java.net.URL url)
Creates and loads properties from the given URL.T
load(java.nio.file.Path path)
Creates and loads properties from the given path.
-
-
-
Method Detail
-
load
public T load(java.lang.ClassLoader classLoader, java.lang.String name) throws java.io.IOException
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:
java.io.IOException
- Thrown if an error occurred reading the input stream.java.lang.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
load
public T load(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
Creates and loads properties from the given file.- Parameters:
file
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
java.io.IOException
- Thrown if an error occurred reading the input stream.java.lang.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.java.io.FileNotFoundException
- Thrown if the file does not exist, is a directory, or cannot be opened for reading.java.lang.SecurityException
- Thrown if a security manager'scheckRead
method denies read access to the file.
-
load
public T load(java.io.InputStream inputStream) throws java.io.IOException
Creates and loads properties from the given input stream.- Parameters:
inputStream
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
java.io.IOException
- Thrown if an error occurred reading the input stream.java.lang.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
load
public T load(java.nio.file.Path path) throws java.io.IOException
Creates and loads properties from the given path.- Parameters:
path
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
java.io.IOException
- Thrown if an error occurred reading the input stream.java.lang.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
load
public T load(java.io.Reader reader) throws java.io.IOException
Creates and loads properties from the given reader.- Parameters:
reader
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
java.io.IOException
- Thrown if an error occurred reading the input stream.java.lang.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
load
public T load(java.lang.String name) throws java.io.IOException
Creates and loads properties from the given file name.- Parameters:
name
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
java.io.IOException
- Thrown if an error occurred reading the input stream.java.lang.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
load
public T load(java.net.URI uri) throws java.io.IOException
Creates and loads properties from the given URI.- Parameters:
uri
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
java.io.IOException
- Thrown if an error occurred reading the input stream.java.lang.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
load
public T load(java.net.URL url) throws java.io.IOException
Creates and loads properties from the given URL.- Parameters:
url
- the location of the properties file.- Returns:
- a new properties object.
- Throws:
java.io.IOException
- Thrown if an error occurred reading the input stream.java.lang.IllegalArgumentException
- Thrown if the input contains a malformed Unicode escape sequence.
-
-