Class ConfigurationHandler


  • public class ConfigurationHandler
    extends java.lang.Object
    The ConfigurationHandler class implements configuration reading form a java.io.InputStream and writing to a java.io.OutputStream on behalf of the FilePersistenceManager class.
     cfg = prop "=" value .
      prop = symbolic-name . // 1.4.2 of OSGi Core Specification
      symbolic-name = token { "." token } .
      token = { [ 0..9 ] | [ a..z ] | [ A..Z ] | '_' | '-' } .
      value = [ type ] ( "[" values "]" | "(" values ")" | simple ) .
      values = simple { "," simple } .
      simple = """ stringsimple """ .
      type = // 1-char type code .
      stringsimple = // quoted string representation of the value .
     
    • Method Detail

      • write

        public static void write​(java.io.OutputStream out,
                                 java.util.Dictionary properties)
                          throws java.io.IOException
        Writes the configuration data from the Dictionary to the given OutputStream.

        This method writes at the current location in the stream and does not close the outputstream.

        Parameters:
        out - The OutputStream to write the configurtion data to.
        properties - The Dictionary to write.
        Throws:
        java.io.IOException - If an error occurrs writing to the output stream.
      • write

        public static java.lang.String write​(java.lang.Object value)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public static java.util.Dictionary read​(java.io.InputStream ins)
                                         throws java.io.IOException
        Reads configuration data from the given InputStream and returns a new Dictionary object containing the data.

        This method reads from the current location in the stream upto the end of the stream but does not close the stream at the end.

        Parameters:
        ins - The InputStream from which to read the configuration data.
        Returns:
        A Dictionary object containing the configuration data. This object may be empty if the stream contains no configuration data.
        Throws:
        java.io.IOException - If an error occurrs reading from the stream. This exception is also thrown if a syntax error is encountered.
      • read

        public static java.lang.Object read​(java.lang.String value)
                                     throws java.io.IOException
        Throws:
        java.io.IOException