Interface ConfigurationFileFormat


  • public interface ConfigurationFileFormat
    A strategy for loading a configuration from an input stream.
    Author:
    Garret Wilson
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      java.util.Set<java.lang.String> getFilenameExtensionSuffixes()
      Retrieves the extension suffixes of files supported by this file format.
      default io.confound.config.Configuration load​(java.io.InputStream inputStream)
      Loads a configuration from the given input stream with no parent configuration.
      io.confound.config.Configuration load​(java.io.InputStream inputStream, io.confound.config.Configuration parentConfiguration)
      Loads a configuration from the given input stream.
    • Method Detail

      • getFilenameExtensionSuffixes

        java.util.Set<java.lang.String> getFilenameExtensionSuffixes()
        Retrieves the extension suffixes of files supported by this file format.

        An extension suffix is merely a file suffix of any type, except that it is understood that the full stop . character U+002E will be prepended to the suffix. For example, an extension suffix of foo.bar would match a file ending in .foo.bar, such as example.foo.bar.

        Returns:
        The extension suffixes of filenames for file type supported by this loader.
      • load

        @Nonnull
        default io.confound.config.Configuration load​(@Nonnull
                                                      java.io.InputStream inputStream)
                                               throws java.io.IOException
        Loads a configuration from the given input stream with no parent configuration.

        The given input stream is guaranteed to support InputStream.mark(int) and InputStream.reset().

        The input stream must not be closed by this method.

        The default implementation delegates to load(InputStream, Configuration) and shuld normally not be overridden.

        Parameters:
        inputStream - The input stream from which the configuration will be loaded.
        Returns:
        A new configuration, loaded from the given input stream.
        Throws:
        java.io.IOException - if there is an error loading a configuration from the giving input stream.
        java.nio.charset.CharacterCodingException - if the given input stream contains an invalid byte sequence for the charset indicated by the BOM; or if no BOM was present, an invalid byte sequence for the assumed charset, depending on the file format.
        See Also:
        InputStream.markSupported()
      • load

        @Nonnull
        io.confound.config.Configuration load​(@Nonnull
                                              java.io.InputStream inputStream,
                                              @Nullable
                                              io.confound.config.Configuration parentConfiguration)
                                       throws java.io.IOException
        Loads a configuration from the given input stream.

        The given input stream is guaranteed to support InputStream.mark(int) and InputStream.reset().

        The input stream must not be closed by this method.

        Parameters:
        inputStream - The input stream from which the configuration will be loaded.
        parentConfiguration - The parent configuration to use for fallback lookup, or null if there is no parent configuration.
        Returns:
        A new configuration, loaded from the given input stream.
        Throws:
        java.io.IOException - if there is an error loading a configuration from the giving input stream.
        java.nio.charset.CharacterCodingException - if the given input stream contains an invalid byte sequence for the charset indicated by the BOM; or if no BOM was present, an invalid byte sequence for the assumed charset, depending on the file format.
        See Also:
        InputStream.markSupported()