org.apache.commons.configuration
Interface FileConfiguration

All Superinterfaces:
Configuration
All Known Implementing Classes:
AbstractFileConfiguration, HierarchicalXMLConfiguration

public interface FileConfiguration
extends Configuration

A persistent configuration loaded and saved to a file.

Since:
1.0-rc2
Version:
$Revision: 1.1 $, $Date: 2004/09/22 17:17:30 $
Author:
Emmanuel Bourg

Method Summary
 String getBasePath()
          Return the base path.
 File getFile()
          Return the file where the configuration is stored.
 String getFileName()
          Return the name of the file.
 URL getURL()
          Return the URL where the configuration is stored.
 void load()
          Load the configuration from the underlying URL.
 void load(File file)
          Load the configuration from the specified file.
 void load(InputStream in)
          Load the configuration from the specified stream, using the default platform specific encoding.
 void load(InputStream in, String encoding)
          Load the configuration from the specified stream, using the specified encoding.
 void load(Reader in)
          Load the configuration from the specified reader.
 void load(String fileName)
          Locate the specified file and load the configuration.
 void load(URL url)
          Load the configuration from the specified URL.
 void save()
          Save the configuration.
 void save(File file)
          Save the configuration to the specified file.
 void save(OutputStream out)
          Save the configuration to the specified stream.
 void save(OutputStream out, String encoding)
          Save the configuration to the specified stream, using the specified encoding.
 void save(String fileName)
          Save the configuration to the specified file.
 void save(URL url)
          Save the configuration to the specified URL if it's a file URL.
 void save(Writer out)
          Save the configuration to the specified writer.
 void setBasePath(String basePath)
          Set the base path.
 void setFile(File file)
          Set the file where the configuration is stored.
 void setFileName(String fileName)
          Set the name of the file.
 void setURL(URL url)
          The URL where the configuration is stored.
 
Methods inherited from interface org.apache.commons.configuration.Configuration
addProperty, clearProperty, containsKey, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, getVector, getVector, isEmpty, setProperty, subset
 

Method Detail

load

public void load()
          throws ConfigurationException
Load the configuration from the underlying URL. If the URL is not specified, it attempts to locate the specified file name.

Throws:
ConfigurationException

load

public void load(String fileName)
          throws ConfigurationException
Locate the specified file and load the configuration.

Parameters:
fileName - the name of the file loaded
Throws:
ConfigurationException

load

public void load(File file)
          throws ConfigurationException
Load the configuration from the specified file.

Parameters:
file - the loaded file
Throws:
ConfigurationException

load

public void load(URL url)
          throws ConfigurationException
Load the configuration from the specified URL.

Parameters:
url - the URL of the file loaded
Throws:
ConfigurationException

load

public void load(InputStream in)
          throws ConfigurationException
Load the configuration from the specified stream, using the default platform specific encoding.

Parameters:
in - the input stream
Throws:
ConfigurationException

load

public void load(InputStream in,
                 String encoding)
          throws ConfigurationException
Load the configuration from the specified stream, using the specified encoding. If the encoding is null the default encoding is used.

Parameters:
in - the input stream
encoding - the encoding used. null to use the default encoding
Throws:
ConfigurationException

load

public void load(Reader in)
          throws ConfigurationException
Load the configuration from the specified reader.

Parameters:
in - the reader
Throws:
ConfigurationException

save

public void save()
          throws ConfigurationException
Save the configuration.

Throws:
ConfigurationException

save

public void save(String fileName)
          throws ConfigurationException
Save the configuration to the specified file.

Parameters:
fileName -
Throws:
ConfigurationException

save

public void save(File file)
          throws ConfigurationException
Save the configuration to the specified file.

Parameters:
file -
Throws:
ConfigurationException

save

public void save(URL url)
          throws ConfigurationException
Save the configuration to the specified URL if it's a file URL.

Parameters:
url -
Throws:
ConfigurationException

save

public void save(OutputStream out)
          throws ConfigurationException
Save the configuration to the specified stream.

Parameters:
out -
Throws:
ConfigurationException

save

public void save(OutputStream out,
                 String encoding)
          throws ConfigurationException
Save the configuration to the specified stream, using the specified encoding. If the encoding is null the default encoding is used.

Parameters:
out -
encoding -
Throws:
ConfigurationException

save

public void save(Writer out)
          throws ConfigurationException
Save the configuration to the specified writer.

Parameters:
out - the writer
Throws:
ConfigurationException

getFileName

public String getFileName()
Return the name of the file.


setFileName

public void setFileName(String fileName)
Set the name of the file.

Parameters:
fileName - the name of the file

getBasePath

public String getBasePath()
Return the base path.


setBasePath

public void setBasePath(String basePath)
Set the base path. Relative configurations are loaded from this path.

Parameters:
basePath - the base path.

getFile

public File getFile()
Return the file where the configuration is stored.


setFile

public void setFile(File file)
Set the file where the configuration is stored.

Parameters:
file -

getURL

public URL getURL()
Return the URL where the configuration is stored.


setURL

public void setURL(URL url)
The URL where the configuration is stored.

Parameters:
url -


Copyright © 2001-2004 The Apache Software Foundation. All Rights Reserved.