Package org.apache.commons.configuration2.io

# Interface FileBased

All Known Subinterfaces:
  `FileBasedConfiguration`

All Known Implementing Classes:
  `INIConfiguration`, `JSONConfiguration`, `PatternSubtreeConfigurationWrapper`, `PropertiesConfiguration`, `PropertyListConfiguration`, `XMLConfiguration`, `XMLPropertiesConfiguration`, `XMLPropertyListConfiguration`, `YAMLConfiguration`

public interface FileBased

Definition of an interface to be implemented by objects which know how to read and write themselves from or to a character stream.

This interface is implemented by special implementations of the `Configuration` interface which are associated with a file. It demands only basic methods for doing I/O based on character stream objects. Based on these methods it is possible to implement other methods which operate on files, file names, URLs, etc.

Note that the methods defined by this interface are not intended to be called directly by client code! Rather, they are used internally when doing I/O operations with a `FileHandler`. A `FileHandler` supports additional functionality (for example it evaluates some additional interfaces the `FileBased` object may implement); this functionality is not available on a direct method invocation, so this may lead to unpredictable results.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `read(Reader in)`
  Reads the content of this object from the given reader.
  `void`
  `write(Writer out)`
  Writes the content of this object to the given writer.

- ## Method Details

  - ### read

    void read(Reader in) throws ConfigurationException, IOException
    Reads the content of this object from the given reader. Client code should not call this method directly, but use a `FileHandler` for reading data.
    Parameters:
      `in` - the reader
    Throws:
      `IOException` - if an I/O error occurs.
      `ConfigurationException` - if a non-I/O related problem occurs, for example the data read does not have the expected format

  - ### write

    void write(Writer out) throws ConfigurationException, IOException
    Writes the content of this object to the given writer. Client code should not call this method directly, but use a `FileHandler` for writing data.
    Parameters:
      `out` - the writer
    Throws:
      `IOException` - if an I/O error occurs.
      `ConfigurationException` - if a non-I/O related problem occurs, for example the data read does not have the expected format