Class PropertiesConfiguration.PropertiesReader

    • Constructor Detail

    • Method Detail

      • getCommentLines

        public List<StringgetCommentLines()
        Gets the comment lines that have been read for the last property.
        Returns:
        the comment lines for the last property returned by readProperty()
        Since:
        1.3
      • getPropertyName

        public String getPropertyName()
        Gets the name of the last read property. This method can be called after nextProperty() was invoked and its return value was true.
        Returns:
        the name of the last read property
        Since:
        1.3
      • getPropertySeparator

        public String getPropertySeparator()
        Gets the separator that was used for the last read property. The separator can be stored so that it can later be restored when saving the configuration.
        Returns:
        the separator for the last read property
        Since:
        1.7
      • getPropertyValue

        public String getPropertyValue()
        Gets the value of the last read property. This method can be called after nextProperty() was invoked and its return value was true.
        Returns:
        the value of the last read property
        Since:
        1.3
      • initPropertyName

        protected void initPropertyName​(String name)
        Sets the name of the current property. This method can be called by parseProperty() for storing the results of the parse operation. It also ensures that the property key is correctly escaped.
        Parameters:
        name - the name of the current property
        Since:
        1.7
      • initPropertySeparator

        protected void initPropertySeparator​(String value)
        Sets the separator of the current property. This method can be called by parseProperty(). It allows the associated layout object to keep track of the property separators. When saving the configuration the separators can be restored.
        Parameters:
        value - the separator used for the current property
        Since:
        1.7
      • initPropertyValue

        protected void initPropertyValue​(String value)
        Sets the value of the current property. This method can be called by parseProperty() for storing the results of the parse operation. It also ensures that the property value is correctly escaped.
        Parameters:
        value - the value of the current property
        Since:
        1.7
      • nextProperty

        public boolean nextProperty()
                             throws IOException
        Parses the next property from the input stream and stores the found name and value in internal fields. These fields can be obtained using the provided getter methods. The return value indicates whether EOF was reached (false) or whether further properties are available (true).
        Returns:
        a flag if further properties are available
        Throws:
        IOException - if an error occurs
        Since:
        1.3
      • parseProperty

        protected void parseProperty​(String line)
        Parses a line read from the properties file. This method is called for each non-comment line read from the source file. Its task is to split the passed in line into the property key and its value. The results of the parse operation can be stored by calling the initPropertyXXX() methods.
        Parameters:
        line - the line read from the properties file
        Since:
        1.7
      • readProperty

        public String readProperty()
                            throws IOException
        Reads a property line. Returns null if Stream is at EOF. Concatenates lines ending with "\". Skips lines beginning with "#" or "!" and empty lines. The return value is a property definition (&lt;name&gt; = &lt;value&gt;)
        Returns:
        A string containing a property value or null
        Throws:
        IOException - in case of an I/O error
      • unescapePropertyName

        protected String unescapePropertyName​(String name)
        Performs unescaping on the given property name.
        Parameters:
        name - the property name
        Returns:
        the unescaped property name
        Since:
        2.4
      • unescapePropertyValue

        protected String unescapePropertyValue​(String value)
        Performs unescaping on the given property value.
        Parameters:
        value - the property value
        Returns:
        the unescaped property value
        Since:
        2.4