Interface ConfigurationPropertyReader

    • Method Detail

      • read

        @Nonnull
        @Immutable
        default java.util.List<ConfigurationProperty> read​(java.io.InputStream inputStream)
                                                    throws java.lang.Throwable
        Reads a list of ConfigurationProperty objects from the provided InputStream.

        This method reads configuration properties from the given input stream, using the default charset for decoding the content. It internally delegates to read(Reader) after wrapping the input stream into an InputStreamReader.

        Example Usage

        
         ConfigurationPropertiesReader reader = ...; // Obtain an instance
         try (InputStream inputStream = new FileInputStream("config.properties")) {
             List<ConfigurationProperty> properties = reader.load(inputStream);
             // Process the loaded properties
         }
         
        Parameters:
        inputStream - the input stream to read from; must not be null
        Returns:
        a list of ConfigurationProperty objects loaded from the input stream
        Throws:
        java.lang.Throwable - if any error occurs during loading
        See Also:
        read(Reader)
      • read

        @Nonnull
        @Immutable
        default java.util.List<ConfigurationProperty> read​(java.io.Reader reader)
                                                    throws java.lang.Throwable
        Reads a list of ConfigurationProperty objects from the provided Reader.

        This method reads configuration properties from the given reader by first copying its content into a string using IOUtils.copyToString(Reader), then delegating to read(String) to perform the actual parsing and loading.

        Example Usage

        
         ConfigurationPropertiesReader reader = ...; // Obtain an instance
         try (Reader fileReader = new FileReader("config.properties")) {
             List<ConfigurationProperty> properties = reader.load(fileReader);
             // Process the loaded properties
         }
         
        Parameters:
        reader - the reader to read from; must not be null
        Returns:
        a list of ConfigurationProperty objects loaded from the reader
        Throws:
        java.lang.Throwable - if any error occurs during loading
        See Also:
        read(String), IOUtils.copyToString(Reader)
      • read

        @Nonnull
        @Immutable
        java.util.List<ConfigurationProperty> read​(java.lang.String content)
                                            throws java.lang.Throwable
        Reads a list of ConfigurationProperty objects from the provided content string.

        This method parses and loads configuration properties from the given string content. The format of the content is determined by the specific implementation of this interface.

        Example Usage

        
         ConfigurationPropertiesReader reader = ...; // Obtain an instance
         String content = "property1=value1\nproperty2=value2";
         List<ConfigurationProperty> properties = reader.load(content);
         // Process the loaded properties
         
        Parameters:
        content - the string content to parse and load from; must not be null
        Returns:
        a list of ConfigurationProperty objects loaded from the content
        Throws:
        java.lang.Throwable - if any error occurs during loading
        See Also:
        ConfigurationProperty