Class ConfigBase

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Option[] options  
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigBase()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract java.lang.String getDefaultConfigPath()  
      java.lang.String getOption​(java.lang.String sName)
      Get a named option
      protected abstract int getOptionCount()  
      void read​(java.io.File file)
      Read a configuration (file based version)
      void read​(java.io.InputStream is)
      Read configuration from a specified input stream
      void readDefaultConfig​(java.lang.String sName)
      Read a default configuration: The available configurations depend on the Converter implementation
      protected abstract void readInner​(org.w3c.dom.Element elm)
      Read configuration information from an xml element.
      void setOption​(java.lang.String sName, java.lang.String sValue)
      Set a name/value option.
      void write​(java.io.File file)
      Write the configuration (file based version)
      void write​(java.io.OutputStream os)
      Write the configuration (stream based version)
      protected abstract void writeInner​(org.w3c.dom.Document dom)
      Write configuration information to an xml document.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • options

        protected Option[] options
    • Constructor Detail

      • ConfigBase

        public ConfigBase()
    • Method Detail

      • getOptionCount

        protected abstract int getOptionCount()
      • getDefaultConfigPath

        protected abstract java.lang.String getDefaultConfigPath()
      • setOption

        public void setOption​(java.lang.String sName,
                              java.lang.String sValue)
        Description copied from interface: Config
        Set a name/value option. Options that are not defined by the Converter implementation as well as null values are silently ignored
        Specified by:
        setOption in interface Config
        Parameters:
        sName - the name of the option
        sValue - the value of the option
      • getOption

        public java.lang.String getOption​(java.lang.String sName)
        Description copied from interface: Config
        Get a named option
        Specified by:
        getOption in interface Config
        Parameters:
        sName - the name of the option
        Returns:
        the value of the option, or null if the option does not exist or the given name is null
      • readDefaultConfig

        public void readDefaultConfig​(java.lang.String sName)
                               throws java.lang.IllegalArgumentException
        Description copied from interface: Config
        Read a default configuration: The available configurations depend on the Converter implementation
        Specified by:
        readDefaultConfig in interface Config
        Parameters:
        sName - the name of the configuration
        Throws:
        java.lang.IllegalArgumentException - if the configuration does not exist
      • read

        public void read​(java.io.InputStream is)
                  throws java.io.IOException

        Read configuration from a specified input stream

        Specified by:
        read in interface Config
        Parameters:
        is - the input stream to read the configuration from
        Throws:
        java.io.IOException - if an error occurs reading the stream, or the data is not in the right format
      • read

        public void read​(java.io.File file)
                  throws java.io.IOException
        Description copied from interface: Config
        Read a configuration (file based version)
        Specified by:
        read in interface Config
        Parameters:
        file - the File to read from
        Throws:
        java.io.IOException - if the file does not exist, an error occurs reading the file, or the data is not in the right format
      • readInner

        protected abstract void readInner​(org.w3c.dom.Element elm)
        Read configuration information from an xml element. The subclass must define this to read richer configuration data
      • write

        public void write​(java.io.OutputStream os)
                   throws java.io.IOException
        Description copied from interface: Config
        Write the configuration (stream based version)
        Specified by:
        write in interface Config
        Parameters:
        os - the OutputStream to write to
        Throws:
        java.io.IOException - if an error occurs writing to the stream
      • write

        public void write​(java.io.File file)
                   throws java.io.IOException
        Description copied from interface: Config
        Write the configuration (file based version)
        Specified by:
        write in interface Config
        Parameters:
        file - the File to write to
        Throws:
        java.io.IOException - if an error occurs writing to the file
      • writeInner

        protected abstract void writeInner​(org.w3c.dom.Document dom)
        Write configuration information to an xml document. The subclass must define this to write richer configuration data