Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.configuration
Class AbstractFileConfiguration

    java.lang.Object
      org.apache.commons.configuration.AbstractConfiguration
          org.apache.commons.configuration.BaseConfiguration
              org.apache.commons.configuration.AbstractFileConfiguration

All Implemented Interfaces:
  Configuration, FileConfiguration

Direct Known Subclasses:
  PropertiesConfiguration, XMLConfiguration

public abstract class AbstractFileConfiguration
extends BaseConfiguration
implements FileConfiguration

Partial implementation of the `FileConfiguration` interface. Developpers of file based configuration may wan't to extend this class, the two methods left to implement are `FileConfiguration.load(Reader)` and `AbstractFileConfiguration#save(Reader)`.

Since:
  1.0-rc2
Version:
  $Revision: 1.4 $, $Date: 2004/10/04 21:45:10 $
Author:
  Emmanuel Bourg

Nested Class Summary

Nested classes inherited from class org.apache.commons.configuration.AbstractConfiguration
`AbstractConfiguration.PropertiesTokenizer`

Field Summary
`protected String` | `basePath`
`protected String` | `fileName`
`protected URL` | `url`

Fields inherited from class org.apache.commons.configuration.AbstractConfiguration
`END_TOKEN, START_TOKEN`

Constructor Summary
`AbstractFileConfiguration()`

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(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` | `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 class org.apache.commons.configuration.BaseConfiguration
`addPropertyDirect, clearProperty, containsKey, getKeys, getPropertyDirect, isEmpty`

Methods inherited from class org.apache.commons.configuration.AbstractConfiguration
`addProperty, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, getVector, getVector, interpolate, interpolateHelper, isThrowExceptionOnMissing, setDelimiter, setProperty, setThrowExceptionOnMissing, split, subset`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.commons.configuration.FileConfiguration
`load, save`

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`

Field Detail

### fileName

    protected String fileName

### basePath

    protected String basePath

### url

    protected URL url

Constructor Detail

### AbstractFileConfiguration

    public AbstractFileConfiguration()

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.

  Specified by:
    `load` in interface `FileConfiguration`
  Throws:
    `ConfigurationException`

### load

    public void load(String fileName)
              throws ConfigurationException

  Locate the specified file and load the configuration.

  Specified by:
    `load` in interface `FileConfiguration`
  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.

  Specified by:
    `load` in interface `FileConfiguration`
  Parameters:
    `file` - the loaded file
  Throws:
    `ConfigurationException`

### load

    public void load(URL url)
              throws ConfigurationException

  Load the configuration from the specified URL.

  Specified by:
    `load` in interface `FileConfiguration`
  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.

  Specified by:
    `load` in interface `FileConfiguration`
  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.

  Specified by:
    `load` in interface `FileConfiguration`
  Parameters:
    `in` - the input stream
    `encoding` - the encoding used. `null` to use the default encoding
  Throws:
    `ConfigurationException`

### save

    public void save()
              throws ConfigurationException

  Save the configuration.

  Specified by:
    `save` in interface `FileConfiguration`
  Throws:
    `ConfigurationException`

### save

    public void save(String fileName)
              throws ConfigurationException

  Save the configuration to the specified file. This doesn't change the source of the configuration, use setFileName() if you need it.

  Specified by:
    `save` in interface `FileConfiguration`
  Parameters:
    `fileName` -
  Throws:
    `ConfigurationException`

### save

    public void save(URL url)
              throws ConfigurationException

  Save the configuration to the specified URL if it's a file URL. This doesn't change the source of the configuration, use setURL() if you need it.

  Specified by:
    `save` in interface `FileConfiguration`
  Parameters:
    `url` -
  Throws:
    `ConfigurationException`

### save

    public void save(File file)
              throws ConfigurationException

  Save the configuration to the specified file. This doesn't change the source of the configuration, use setFile() if you need it.

  Specified by:
    `save` in interface `FileConfiguration`
  Parameters:
    `file` -
  Throws:
    `ConfigurationException`

### save

    public void save(OutputStream out)
              throws ConfigurationException

  Save the configuration to the specified stream.

  Specified by:
    `save` in interface `FileConfiguration`
  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.

  Specified by:
    `save` in interface `FileConfiguration`
  Parameters:
    `out` -
    `encoding` -
  Throws:
    `ConfigurationException`

### getFileName

    public String getFileName()

  Return the name of the file.

  Specified by:
    `getFileName` in interface `FileConfiguration`

### setFileName

    public void setFileName(String fileName)

  Set the name of the file.

  Specified by:
    `setFileName` in interface `FileConfiguration`
  Parameters:
    `fileName` - the name of the file

### getBasePath

    public String getBasePath()

  Return the base path.

  Specified by:
    `getBasePath` in interface `FileConfiguration`

### setBasePath

    public void setBasePath(String basePath)

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

  Specified by:
    `setBasePath` in interface `FileConfiguration`
  Parameters:
    `basePath` - the base path.

### getFile

    public File getFile()

  Return the file where the configuration is stored.

  Specified by:
    `getFile` in interface `FileConfiguration`

### setFile

    public void setFile(File file)

  Set the file where the configuration is stored.

  Specified by:
    `setFile` in interface `FileConfiguration`
  Parameters:
    `file` -

### getURL

    public URL getURL()

  Return the URL where the configuration is stored.

  Specified by:
    `getURL` in interface `FileConfiguration`

### setURL

    public void setURL(URL url)

  The URL where the configuration is stored.

  Specified by:
    `setURL` in interface `FileConfiguration`
  Parameters:
    `url` -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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