Interface SettingsReader

All Known Implementing Classes:
DefaultSettingsReader

public interface SettingsReader
Handles deserialization of settings from some kind of textual format like XML.
Author:
Benjamin Bentmann
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The key for the option to enable strict parsing.
  • Method Summary

    Modifier and Type
    Method
    Description
    read(File input, Map<String,?> options)
    Reads the settings from the specified file.
    read(InputStream input, Map<String,?> options)
    Reads the settings from the specified byte stream.
    read(Reader input, Map<String,?> options)
    Reads the settings from the specified character reader.
  • Field Details

    • IS_STRICT

      static final String IS_STRICT
      The key for the option to enable strict parsing. This option is of type Boolean and defaults to true. If false, unknown elements will be ignored instead of causing a failure.
      See Also:
  • Method Details

    • read

      Settings read(File input, Map<String,?> options) throws IOException, SettingsParseException
      Reads the settings from the specified file.
      Parameters:
      input - The file to deserialize the settings from, must not be null.
      options - The options to use for deserialization, may be null to use the default values.
      Returns:
      The deserialized settings, never null.
      Throws:
      IOException - If the settings could not be deserialized.
      SettingsParseException - If the input format could not be parsed.
    • read

      Settings read(Reader input, Map<String,?> options) throws IOException, SettingsParseException
      Reads the settings from the specified character reader. The reader will be automatically closed before the method returns.
      Parameters:
      input - The reader to deserialize the settings from, must not be null.
      options - The options to use for deserialization, may be null to use the default values.
      Returns:
      The deserialized settings, never null.
      Throws:
      IOException - If the settings could not be deserialized.
      SettingsParseException - If the input format could not be parsed.
    • read

      Reads the settings from the specified byte stream. The stream will be automatically closed before the method returns.
      Parameters:
      input - The stream to deserialize the settings from, must not be null.
      options - The options to use for deserialization, may be null to use the default values.
      Returns:
      The deserialized settings, never null.
      Throws:
      IOException - If the settings could not be deserialized.
      SettingsParseException - If the input format could not be parsed.