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 
      Modifier and Type Method Description
      java.util.Set<java.lang.String> getFilenameExtensions()
      Retrieves the extensions of files supported by this file format.
      io.confound.config.Configuration load​(java.io.InputStream inputStream)
      Loads a configuration from the given input stream.
    • Method Detail

      • getFilenameExtensions

        java.util.Set<java.lang.String> getFilenameExtensions()
        Retrieves the extensions of files supported by this file format.

        An extension 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 of foo.bar would match a file ending in .foo.bar, such as example.foo.bar.

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

        @Nonnull
        io.confound.config.Configuration load​(@Nonnull
                                              java.io.InputStream inputStream)
                                       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.
        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 is for a text document and 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()