public class ConfigurationSource extends Object
| Modifier and Type | Field | Description |
|---|---|---|
static ConfigurationSource |
NULL_SOURCE |
ConfigurationSource to use with Configurations that do not require a "real" configuration source.
|
| Constructor | Description |
|---|---|
ConfigurationSource(InputStream stream) |
Constructs a new
ConfigurationSource with the specified input stream. |
ConfigurationSource(InputStream stream,
File file) |
Constructs a new
ConfigurationSource with the specified input stream that originated from the specified
file. |
ConfigurationSource(InputStream stream,
URL url) |
Constructs a new
ConfigurationSource with the specified input stream that originated from the specified
url. |
| Modifier and Type | Method | Description |
|---|---|---|
static ConfigurationSource |
fromResource(String resource,
ClassLoader loader) |
Retrieves the configuration via the ClassLoader.
|
static ConfigurationSource |
fromUri(URI configLocation) |
Loads the configuration from a URI.
|
File |
getFile() |
Returns the file configuration source, or
null if this configuration source is based on an URL or has
neither a file nor an URL. |
InputStream |
getInputStream() |
Returns the input stream that this configuration source was constructed with.
|
String |
getLocation() |
Returns a string describing the configuration source file or URL, or
null if this configuration source
has neither a file nor an URL. |
URI |
getURI() |
Returns a URI representing the configuration resource or null if it cannot be determined.
|
URL |
getURL() |
Returns the configuration source URL, or
null if this configuration source is based on a file or has
neither a file nor an URL. |
ConfigurationSource |
resetInputStream() |
Returns a new
ConfigurationSource whose input stream is reset to the beginning. |
String |
toString() |
public static final ConfigurationSource NULL_SOURCE
public ConfigurationSource(InputStream stream, File file)
ConfigurationSource with the specified input stream that originated from the specified
file.stream - the input streamfile - the file where the input stream originatedpublic ConfigurationSource(InputStream stream, URL url)
ConfigurationSource with the specified input stream that originated from the specified
url.stream - the input streamurl - the URL where the input stream originatedpublic ConfigurationSource(InputStream stream) throws IOException
ConfigurationSource with the specified input stream. Since the stream is the only source
of data, this constructor makes a copy of the stream contents.stream - the input streamIOException - if an exception occurred reading from the specified streampublic File getFile()
null if this configuration source is based on an URL or has
neither a file nor an URL.nullpublic URL getURL()
null if this configuration source is based on a file or has
neither a file nor an URL.nullpublic URI getURI()
public String getLocation()
null if this configuration source
has neither a file nor an URL.nullpublic InputStream getInputStream()
public ConfigurationSource resetInputStream() throws IOException
ConfigurationSource whose input stream is reset to the beginning.ConfigurationSourceIOException - if a problem occurred while opening the new input streampublic static ConfigurationSource fromUri(URI configLocation)
configLocation - A URI representing the location of the configuration.public static ConfigurationSource fromResource(String resource, ClassLoader loader)
resource - The resource to load.loader - The default ClassLoader to use.Copyright © 1999-2018. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.