Package org.ini4j

Class IniPreferences

    • Field Summary

      • Fields inherited from class java.util.prefs.AbstractPreferences

        lock, newNode
      • Fields inherited from class java.util.prefs.Preferences

        MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_VALUE_LENGTH
    • Constructor Summary

      Constructors 
      Constructor Description
      IniPreferences​(InputStream input)
      Constructs a new preferences node based on newly loaded Ini instance.
      IniPreferences​(Reader input)
      Constructs a new preferences node based on newly loaded Ini instance.
      IniPreferences​(URL input)
      Constructs a new preferences node based on newly loaded Ini instance.
      IniPreferences​(Ini ini)
      Constructs a new preferences node on top of Ini instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected String[] childrenNamesSpi()
      Implements the childrenNamesSpi method as per the specification in AbstractPreferences.childrenNamesSpi().
      protected IniPreferences.SectionPreferences childSpi​(String name)
      Implements the childSpi method as per the specification in AbstractPreferences.childSpi(String).
      protected void flushSpi()
      Implements the flushSpi method as per the specification in AbstractPreferences.flushSpi().
      protected Ini getIni()
      Provide access to underlaying Ini implementation.
      protected String getSpi​(String key)
      Implements the getSpi method as per the specification in AbstractPreferences.getSpi(String).
      protected String[] keysSpi()
      Implements the keysSpi method as per the specification in AbstractPreferences.keysSpi().
      protected void putSpi​(String key, String value)
      Implements the putSpi method as per the specification in AbstractPreferences.putSpi(String,String).
      protected void removeNodeSpi()
      Implements the removeNodeSpi method as per the specification in AbstractPreferences.removeNodeSpi().
      protected void removeSpi​(String key)
      Implements the removeSpi method as per the specification in AbstractPreferences.removeSpi(String).
      protected void syncSpi()
      Implements the syncSpi method as per the specification in AbstractPreferences.syncSpi().
      • Methods inherited from class java.util.prefs.AbstractPreferences

        absolutePath, addNodeChangeListener, addPreferenceChangeListener, cachedChildren, childrenNames, clear, exportNode, exportSubtree, flush, get, getBoolean, getByteArray, getChild, getDouble, getFloat, getInt, getLong, isRemoved, isUserNode, keys, name, node, nodeExists, parent, put, putBoolean, putByteArray, putDouble, putFloat, putInt, putLong, remove, removeNode, removeNodeChangeListener, removePreferenceChangeListener, sync, toString
      • Methods inherited from class java.util.prefs.Preferences

        importPreferences, systemNodeForPackage, systemRoot, userNodeForPackage, userRoot
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • IniPreferences

        public IniPreferences​(Ini ini)
        Constructs a new preferences node on top of Ini instance.
        Parameters:
        ini - underlaying Ini instance
      • IniPreferences

        public IniPreferences​(Reader input)
                       throws IOException,
                              InvalidFileFormatException
        Constructs a new preferences node based on newly loaded Ini instance. This is just a helper constructor, to make simpler constructing IniPreferences directly from Reader.
        Parameters:
        input - the Reader containing Ini data
        Throws:
        IOException - if an I/O error occured
        InvalidFileFormatException - if Ini parsing error occured
      • IniPreferences

        public IniPreferences​(InputStream input)
                       throws IOException,
                              InvalidFileFormatException
        Constructs a new preferences node based on newly loaded Ini instance. This is just a helper constructor, to make simpler constructing IniPreferences directly from InputStream.
        Parameters:
        input - the InputStream containing Ini data
        Throws:
        IOException - if an I/O error occured
        InvalidFileFormatException - if Ini parsing error occured
      • IniPreferences

        public IniPreferences​(URL input)
                       throws IOException,
                              InvalidFileFormatException
        Constructs a new preferences node based on newly loaded Ini instance. This is just a helper constructor, to make simpler constructing IniPreferences directly from URL.
        Parameters:
        input - the URL containing Ini data
        Throws:
        IOException - if an I/O error occured
        InvalidFileFormatException - if Ini parsing error occured
    • Method Detail

      • getIni

        protected Ini getIni()
        Provide access to underlaying Ini implementation.
        Returns:
        Ini implementation
      • getSpi

        protected String getSpi​(String key)
                         throws UnsupportedOperationException
        Implements the getSpi method as per the specification in AbstractPreferences.getSpi(String). This implementation doesn't support this operation, so allways throws UnsupportedOperationException.
        Specified by:
        getSpi in class AbstractPreferences
        Parameters:
        key - key to getvalue for
        Returns:
        if the value associated with the specified key at this preference node, or null if there is no association for this key, or the association cannot be determined at this time.
        Throws:
        UnsupportedOperationException - this implementation allways throws this exception
      • childrenNamesSpi

        protected String[] childrenNamesSpi()
                                     throws BackingStoreException
        Implements the childrenNamesSpi method as per the specification in AbstractPreferences.childrenNamesSpi().
        Specified by:
        childrenNamesSpi in class AbstractPreferences
        Returns:
        an array containing the names of the children of this preference node.
        Throws:
        BackingStoreException - if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.
      • childSpi

        protected IniPreferences.SectionPreferences childSpi​(String name)
        Implements the childSpi method as per the specification in AbstractPreferences.childSpi(String).
        Specified by:
        childSpi in class AbstractPreferences
        Parameters:
        name - child name
        Returns:
        child node
      • flushSpi

        protected void flushSpi()
                         throws BackingStoreException
        Implements the flushSpi method as per the specification in AbstractPreferences.flushSpi(). This implementation does nothing.
        Specified by:
        flushSpi in class AbstractPreferences
        Throws:
        BackingStoreException - if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.
      • keysSpi

        protected String[] keysSpi()
                            throws BackingStoreException
        Implements the keysSpi method as per the specification in AbstractPreferences.keysSpi(). This implementation allways return an empty array.
        Specified by:
        keysSpi in class AbstractPreferences
        Returns:
        an empty array.
        Throws:
        BackingStoreException - if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.
      • putSpi

        protected void putSpi​(String key,
                              String value)
                       throws UnsupportedOperationException
        Implements the putSpi method as per the specification in AbstractPreferences.putSpi(String,String). This implementation doesn;t support this operation, so allways throws UnsupportedOperationException.
        Specified by:
        putSpi in class AbstractPreferences
        Parameters:
        key - key to set value for
        value - new value for key
        Throws:
        UnsupportedOperationException - this implementation allways throws this exception
      • removeNodeSpi

        protected void removeNodeSpi()
                              throws BackingStoreException,
                                     UnsupportedOperationException
        Implements the removeNodeSpi method as per the specification in AbstractPreferences.removeNodeSpi(). This implementation doesn;t support this operation, so allways throws UnsupportedOperationException.
        Specified by:
        removeNodeSpi in class AbstractPreferences
        Throws:
        UnsupportedOperationException - this implementation allways throws this exception
        BackingStoreException - this implementation never throws this exception
      • removeSpi

        protected void removeSpi​(String key)
                          throws UnsupportedOperationException
        Implements the removeSpi method as per the specification in AbstractPreferences.removeSpi(String).
        Specified by:
        removeSpi in class AbstractPreferences
        Parameters:
        key - key to remove
        Throws:
        UnsupportedOperationException - this implementation allways throws this exception
      • syncSpi

        protected void syncSpi()
                        throws BackingStoreException
        Implements the syncSpi method as per the specification in AbstractPreferences.syncSpi(). This implementation does nothing.
        Specified by:
        syncSpi in class AbstractPreferences
        Throws:
        BackingStoreException - if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.