public class ConfigurationSource extends Object
| Modifier and Type | Field and Description |
|---|---|
static ConfigurationSource |
NULL_SOURCE
ConfigurationSource to use with Configurations that do not require a "real" configuration source.
|
| Constructor and 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 and Description |
|---|---|
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 streamCopyright © 1999-2017. 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.