⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preferences.java

📁 gcc的JAVA模块的源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * Returns all the direct sub nodes of this preferences node.     * Needs access to the backing store to give a meaningfull answer.     *     * @exception BackingStoreException when the backing store cannot be     *            reached     * @exception IllegalStateException when this node has been removed     */    abstract public String[] childrenNames() throws BackingStoreException;    /**     * Returns a sub node of this preferences node if the given path is     * relative (does not start with a '/') or a sub node of the root     * if the path is absolute (does start with a '/').     *     * @exception IllegalStateException if this node has been removed     * @exception IllegalArgumentException if the path contains two or more     * consecutive '/' characters, ends with a '/' charactor and is not the     * string "/" (indicating the root node) or any name on the path is more     * then 80 characters long     */    abstract public Preferences node(String path);    /**     * Returns true if the node that the path points to exists in memory or     * in the backing store. Otherwise it returns false or an exception is     * thrown. When this node is removed the only valid parameter is the     * empty string (indicating this node), the return value in that case     * will be false.     *     * @exception BackingStoreException when the backing store cannot be     *            reached     * @exception IllegalStateException if this node has been removed     *            and the path is not the empty string (indicating this node)     * @exception IllegalArgumentException if the path contains two or more     * consecutive '/' characters, ends with a '/' charactor and is not the     * string "/" (indicating the root node) or any name on the path is more     * then 80 characters long     */    abstract public boolean nodeExists(String path)                                throws BackingStoreException;    /**     * Returns the parent preferences node of this node or null if this is     * the root of the preferences tree.     *     * @exception IllegalStateException if this node has been removed     */    abstract public Preferences parent();    // abstract methods (export)    /**     * XXX     */    abstract public void exportNode(OutputStream os)                                throws BackingStoreException,                                       IOException;    /**     * XXX     */    abstract public void exportSubtree(OutputStream os)                                throws BackingStoreException,                                       IOException;    // abstract methods (preference entry manipulation)    /**     * Returns an (possibly empty) array with all the keys of the preference     * entries of this node.     *     * @exception BackingStoreException when the backing store cannot be     *            reached     * @exception IllegalStateException if this node has been removed     */    abstract public String[] keys() throws BackingStoreException;    /**     * Returns the value associated with the key in this preferences node. If     * the default value of the key cannot be found in the preferences node     * entries or something goes wrong with the backing store the supplied     * default value is returned.     *     * @exception IllegalArgumentException if key is larger then 80 characters     * @exception IllegalStateException if this node has been removed     * @exception NullPointerException if key is null     */    abstract public String get(String key, String defaultVal);    /**     * Convenience method for getting the given entry as a boolean.     * When the string representation of the requested entry is either     * "true" or "false" (ignoring case) then that value is returned,     * otherwise the given default boolean value is returned.     *     * @exception IllegalArgumentException if key is larger then 80 characters     * @exception IllegalStateException if this node has been removed     * @exception NullPointerException if key is null     */    abstract public boolean getBoolean(String key, boolean defaultVal);    /**     * Convenience method for getting the given entry as a byte array.     * When the string representation of the requested entry is a valid     * Base64 encoded string (without any other characters, such as newlines)     * then the decoded Base64 string is returned as byte array,     * otherwise the given default byte array value is returned.     *     * @exception IllegalArgumentException if key is larger then 80 characters     * @exception IllegalStateException if this node has been removed     * @exception NullPointerException if key is null     */    abstract public byte[] getByteArray(String key, byte[] defaultVal);    /**     * Convenience method for getting the given entry as a double.     * When the string representation of the requested entry can be decoded     * with <code>Double.parseDouble()</code> then that double is returned,     * otherwise the given default double value is returned.     *     * @exception IllegalArgumentException if key is larger then 80 characters     * @exception IllegalStateException if this node has been removed     * @exception NullPointerException if key is null     */    abstract public double getDouble(String key, double defaultVal);    /**     * Convenience method for getting the given entry as a float.     * When the string representation of the requested entry can be decoded     * with <code>Float.parseFloat()</code> then that float is returned,     * otherwise the given default float value is returned.     *     * @exception IllegalArgumentException if key is larger then 80 characters     * @exception IllegalStateException if this node has been removed     * @exception NullPointerException if key is null     */    abstract public float getFloat(String key, float defaultVal);    /**     * Convenience method for getting the given entry as an integer.     * When the string representation of the requested entry can be decoded     * with <code>Integer.parseInt()</code> then that integer is returned,     * otherwise the given default integer value is returned.     *     * @exception IllegalArgumentException if key is larger then 80 characters     * @exception IllegalStateException if this node has been removed     * @exception NullPointerException if key is null     */    abstract public int getInt(String key, int defaultVal);    /**     * Convenience method for getting the given entry as a long.     * When the string representation of the requested entry can be decoded     * with <code>Long.parseLong()</code> then that long is returned,     * otherwise the given default long value is returned.     *     * @exception IllegalArgumentException if key is larger then 80 characters     * @exception IllegalStateException if this node has been removed     * @exception NullPointerException if key is null     */    abstract public long getLong(String key, long defaultVal);    /**     * Sets the value of the given preferences entry for this node.     * Key and value cannot be null, the key cannot exceed 80 characters     * and the value cannot exceed 8192 characters.     * <p>     * The result will be immediatly visible in this VM, but may not be     * immediatly written to the backing store.     *     * @exception NullPointerException if either key or value are null     * @exception IllegalArgumentException if either key or value are to large     * @exception IllegalStateException when this node has been removed     */    abstract public void put(String key, String value);    /**     * Convenience method for setting the given entry as a boolean.     * The boolean is converted with <code>Boolean.toString(value)</code>     * and then stored in the preference entry as that string.     *     * @exception NullPointerException if key is null     * @exception IllegalArgumentException if the key length is to large     * @exception IllegalStateException when this node has been removed     */    abstract public void putBoolean(String key, boolean value);    /**     * Convenience method for setting the given entry as an array of bytes.     * The byte array is converted to a Base64 encoded string     * and then stored in the preference entry as that string.     * <p>     * Note that a byte array encoded as a Base64 string will be about 1.3     * times larger then the original length of the byte array, which means     * that the byte array may not be larger about 6 KB.     *     * @exception NullPointerException if either key or value are null     * @exception IllegalArgumentException if either key or value are to large     * @exception IllegalStateException when this node has been removed     */    abstract public void putByteArray(String key, byte[] value);    /**     * Convenience method for setting the given entry as a double.     * The double is converted with <code>Double.toString(double)</code>     * and then stored in the preference entry as that string.     *     * @exception NullPointerException if the key is null     * @exception IllegalArgumentException if the key length is to large     * @exception IllegalStateException when this node has been removed     */    abstract public void putDouble(String key, double value);    /**     * Convenience method for setting the given entry as a float.     * The float is converted with <code>Float.toString(float)</code>     * and then stored in the preference entry as that string.     *     * @exception NullPointerException if the key is null     * @exception IllegalArgumentException if the key length is to large     * @exception IllegalStateException when this node has been removed     */    abstract public void putFloat(String key, float value);    /**     * Convenience method for setting the given entry as an integer.     * The integer is converted with <code>Integer.toString(int)</code>     * and then stored in the preference entry as that string.     *     * @exception NullPointerException if the key is null     * @exception IllegalArgumentException if the key length is to large     * @exception IllegalStateException when this node has been removed     */    abstract public void putInt(String key, int value);    /**     * Convenience method for setting the given entry as a long.     * The long is converted with <code>Long.toString(long)</code>     * and then stored in the preference entry as that string.     *     * @exception NullPointerException if the key is null     * @exception IllegalArgumentException if the key length is to large     * @exception IllegalStateException when this node has been removed     */    abstract public void putLong(String key, long value);    /**     * Removes the preferences entry from this preferences node.     * <p>     * The result will be immediatly visible in this VM, but may not be     * immediatly written to the backing store.     *     * @exception NullPointerException if the key is null     * @exception IllegalArgumentException if the key length is to large     * @exception IllegalStateException when this node has been removed     */    abstract public void remove(String key);    // abstract methods (preference node manipulation)    /**     * Removes all entries from this preferences node. May need access to the     * backing store to get and clear all entries.     * <p>     * The result will be immediatly visible in this VM, but may not be     * immediatly written to the backing store.     *     * @exception BackingStoreException when the backing store cannot be     *            reached     * @exception IllegalStateException if this node has been removed     */    abstract public void clear() throws BackingStoreException;    /**     * Writes all preference changes on this and any subnode that have not     * yet been written to the backing store. This has no effect on the     * preference entries in this VM, but it makes sure that all changes     * are visible to other programs (other VMs might need to call the     * <code>sync()</code> method to actually see the changes to the backing     * store.     *     * @exception BackingStoreException when the backing store cannot be     *            reached     * @exception IllegalStateException if this node has been removed     */    abstract public void flush() throws BackingStoreException;    /**     * Writes and reads all preference changes to and from this and any     * subnodes. This makes sure that all local changes are written to the     * backing store and that all changes to the backing store are visible     * in this preference node (and all subnodes).     *     * @exception BackingStoreException when the backing store cannot be     *            reached     * @exception IllegalStateException if this node has been removed     */    abstract public void sync() throws BackingStoreException;    /**     * Removes this and all subnodes from the backing store and clears all     * entries. After removal this instance will not be useable (except for     * a few methods that don't throw a <code>InvalidStateException</code>),     * even when a new node with the same path name is created this instance     * will not be usable again. The root (system or user) may never be removed.     * <p>     * Note that according to the specification an implementation may delay     * removal of the node from the backing store till the <code>flush()</code>     * method is called. But the <code>flush()</code> method may throw a      * <code>IllegalStateException</code> when the node has been removed.     * So most implementations will actually remove the node and any subnodes     * from the backing store immediatly.     *     * @exception BackingStoreException when the backing store cannot be     *            reached     * @exception IllegalStateException if this node has already been removed     * @exception UnsupportedOperationException if this is a root node     */    abstract public void removeNode() throws BackingStoreException;    // abstract methods (listeners)    abstract public void addNodeChangeListener(NodeChangeListener listener);    abstract public void addPreferenceChangeListener                            (PreferenceChangeListener listener);    abstract public void removeNodeChangeListener(NodeChangeListener listener);    abstract public void removePreferenceChangeListener                            (PreferenceChangeListener listener);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -