## org.apache.commons.configuration
Interface FileConfiguration

All Superinterfaces:
  Configuration

All Known Implementing Classes:
  AbstractFileConfiguration, AbstractHierarchicalFileConfiguration, AbstractHierarchicalFileConfiguration.FileConfigurationDelegate, DefaultConfigurationBuilder, HierarchicalXMLConfiguration, PropertiesConfiguration, PropertyListConfiguration, XMLConfiguration, XMLPropertiesConfiguration, XMLPropertyListConfiguration

    public interface FileConfiguration

extends Configuration

A persistent configuration loaded and saved to a file.

Since:
  1.0-rc2
Version:
  $Revision: 439648 $, $Date: 2006-09-02 22:42:10 +0200 (Sa, 02 Sep 2006) $
Author:
  Emmanuel Bourg

Method Summary
`String` `getBasePath()` Return the base path.
`String` `getEncoding()` Return the encoding used to store the configuration file.
`File` `getFile()` Return the file where the configuration is stored.
`String` `getFileName()` Return the name of the file.
`ReloadingStrategy` `getReloadingStrategy()` Return the reloading strategy.
`URL` `getURL()` Return the URL where the configuration is stored.
`boolean` `isAutoSave()` Tells if properties are automatically saved to the disk.
`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 encoding returned by `getEncoding()`.
`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` `reload()` Reload the configuration.
`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, using the encoding returned by `getEncoding()`.
`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` `setAutoSave(boolean autoSave)` Enable or disable the automatical saving of modified properties to the disk.
`void` `setBasePath(String basePath)` Set the base path.
`void` `setEncoding(String encoding)` Set the encoding used to store the configuration file.
`void` `setFile(File file)` Set the file where the configuration is stored.
`void` `setFileName(String fileName)` Set the name of the file.
`void` `setReloadingStrategy(ReloadingStrategy strategy)` Set the reloading strategy.
`void` `setURL(URL url)` The URL where the configuration is stored.

Methods inherited from interface org.apache.commons.configuration.Configuration

`addProperty, clear, 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, isEmpty, setProperty, subset`

Method Detail

### load

    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` - if an error occurs during the load operation

### load

    void load(String fileName)
              throws ConfigurationException

  Locate the specified file and load the configuration.

  Parameters:
    `fileName` - the name of the file loaded
  Throws:
    `ConfigurationException` - if an error occurs during the load operation

### load

    void load(File file)
              throws ConfigurationException

  Load the configuration from the specified file.

  Parameters:
    `file` - the loaded file
  Throws:
    `ConfigurationException` - if an error occurs during the load operation

### load

    void load(URL url)
              throws ConfigurationException

  Load the configuration from the specified URL.

  Parameters:
    `url` - the URL of the file loaded
  Throws:
    `ConfigurationException` - if an error occurs during the load operation

### load

    void load(InputStream in)
              throws ConfigurationException

  Load the configuration from the specified stream, using the encoding returned by `getEncoding()`.

  Parameters:
    `in` - the input stream
  Throws:
    `ConfigurationException` - if an error occurs during the load operation

### load

    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` - if an error occurs during the load operation

### load

    void load(Reader in)
              throws ConfigurationException

  Load the configuration from the specified reader.

  Parameters:
    `in` - the reader
  Throws:
    `ConfigurationException` - if an error occurs during the load operation

### save

    void save()
              throws ConfigurationException

  Save the configuration.

  Throws:
    `ConfigurationException` - if an error occurs during the save operation

### save

    void save(String fileName)
              throws ConfigurationException

  Save the configuration to the specified file.

  Parameters:
    `fileName` - the name of the file to be saved
  Throws:
    `ConfigurationException` - if an error occurs during the save operation

### save

    void save(File file)
              throws ConfigurationException

  Save the configuration to the specified file.

  Parameters:
    `file` - specifies the file to be saved
  Throws:
    `ConfigurationException` - if an error occurs during the save operation

### save

    void save(URL url)
              throws ConfigurationException

  Save the configuration to the specified URL if it's a file URL.

  Parameters:
    `url` - the URL
  Throws:
    `ConfigurationException` - if an error occurs during the save operation

### save

    void save(OutputStream out)
              throws ConfigurationException

  Save the configuration to the specified stream, using the encoding returned by `getEncoding()`.

  Parameters:
    `out` - the output stream
  Throws:
    `ConfigurationException` - if an error occurs during the save operation

### save

    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` - the output stream
    `encoding` - the encoding to be used
  Throws:
    `ConfigurationException` - if an error occurs during the save operation

### save

    void save(Writer out)
              throws ConfigurationException

  Save the configuration to the specified writer.

  Parameters:
    `out` - the writer
  Throws:
    `ConfigurationException` - if an error occurs during the save operation

### getFileName

    String getFileName()

  Return the name of the file.

  Returns:
    the file name

### setFileName

    void setFileName(String fileName)

  Set the name of the file.

  Parameters:
    `fileName` - the name of the file

### getBasePath

    String getBasePath()

  Return the base path.

  Returns:
    the base path

### setBasePath

    void setBasePath(String basePath)

  Set the base path. Relative configurations are loaded from this path.

  Parameters:
    `basePath` - the base path.

### getFile

    File getFile()

  Return the file where the configuration is stored.

  Returns:
    the configuration file

### setFile

    void setFile(File file)

  Set the file where the configuration is stored.

  Parameters:
    `file` - the file

### getURL

    URL getURL()

  Return the URL where the configuration is stored.

  Returns:
    the URL of the configuration

### setURL

    void setURL(URL url)

  The URL where the configuration is stored.

  Parameters:
    `url` - the URL

### setAutoSave

    void setAutoSave(boolean autoSave)

  Enable or disable the automatical saving of modified properties to the disk.

  Parameters:
    `autoSave` - `true` to enable, `false` to disable
  Since:
    1.1

### isAutoSave

    boolean isAutoSave()

  Tells if properties are automatically saved to the disk.

  Returns:
    `true` if auto-saving is enabled, `false` otherwise
  Since:
    1.1

### getReloadingStrategy

    ReloadingStrategy getReloadingStrategy()

  Return the reloading strategy.

  Returns:
    the reloading strategy currently used
  Since:
    1.1

### setReloadingStrategy

    void setReloadingStrategy(ReloadingStrategy strategy)

  Set the reloading strategy.

  Parameters:
    `strategy` - the reloading strategy to use
  Since:
    1.1

### reload

    void reload()

  Reload the configuration.

  Since:
    1.1

### getEncoding

    String getEncoding()

  Return the encoding used to store the configuration file. If the value is null the default encoding is used.

  Returns:
    the current encoding
  Since:
    1.1

### setEncoding

    void setEncoding(String encoding)

  Set the encoding used to store the configuration file. Set the encoding to null to use the default encoding.

  Parameters:
    `encoding` - the encoding to use
  Since:
    1.1

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