org.apache.logging.log4j.core.config
Class ConfigurationSource

java.lang.Object
  extended by org.apache.logging.log4j.core.config.ConfigurationSource

public class ConfigurationSource
extends Object

Represents the source for the logging configuration.


Field Summary
static ConfigurationSource NULL_SOURCE
           
 
Constructor Summary
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.
 
Method Summary
 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.
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_SOURCE

public static final ConfigurationSource NULL_SOURCE
Constructor Detail

ConfigurationSource

public ConfigurationSource(InputStream stream)
                    throws IOException
Constructs a new ConfigurationSource with the specified input stream. Since the stream is the only source of data, this constructor makes a copy of the stream contents.

Parameters:
stream - the input stream
Throws:
IOException - if an exception occurred reading from the specified stream

ConfigurationSource

public ConfigurationSource(InputStream stream,
                           File file)
Constructs a new ConfigurationSource with the specified input stream that originated from the specified file.

Parameters:
stream - the input stream
file - the file where the input stream originated

ConfigurationSource

public ConfigurationSource(InputStream stream,
                           URL url)
Constructs a new ConfigurationSource with the specified input stream that originated from the specified url.

Parameters:
stream - the input stream
url - the URL where the input stream originated
Method Detail

getFile

public 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.

Returns:
the configuration source file, or null

getURL

public 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.

Returns:
the configuration source URL, or null

getLocation

public 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.

Returns:
a string describing the configuration source file or URL, or null

getInputStream

public InputStream getInputStream()
Returns the input stream that this configuration source was constructed with.

Returns:
the input stream that this configuration source was constructed with.

resetInputStream

public ConfigurationSource resetInputStream()
                                     throws IOException
Returns a new ConfigurationSource whose input stream is reset to the beginning.

Returns:
a new ConfigurationSource
Throws:
IOException - if a problem occurred while opening the new input stream

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1999-2014 Apache Software Foundation. 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.