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 (e.g. 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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void read​(java.io.Reader in)
      Reads the content of this object from the given reader.
      void write​(java.io.Writer out)
      Writes the content of this object to the given writer.
    • Method Detail

      • read

        void read​(java.io.Reader in)
           throws ConfigurationException,
                  java.io.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:
        java.io.IOException - if an I/O error occurs.
        ConfigurationException - if a non-I/O related problem occurs, e.g. the data read does not have the expected format
      • write

        void write​(java.io.Writer out)
            throws ConfigurationException,
                   java.io.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:
        java.io.IOException - if an I/O error occurs.
        ConfigurationException - if a non-I/O related problem occurs, e.g. the data read does not have the expected format