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

📄 preferences.java

📁 java源代码 请看看啊 提点宝贵的意见
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
     * specified key in this preference node.  Valid strings     * are <tt>"true"</tt>, which represents true, and <tt>"false"</tt>, which     * represents false.  Case is ignored, so, for example, <tt>"TRUE"</tt>     * and <tt>"False"</tt> are also valid.  This method is intended for use in     * conjunction with {@link #putBoolean}.     *     * <p>Returns the specified default if there is no value     * associated with the key, the backing store is inaccessible, or if the     * associated value is something other than <tt>"true"</tt> or     * <tt>"false"</tt>, ignoring case.     *     * <p>If the implementation supports <i>stored defaults</i> and such a     * default exists and is accessible, it is used in preference to the     * specified default, unless the stored default is something other than     * <tt>"true"</tt> or <tt>"false"</tt>, ignoring case, in which case the     * specified default is used.     *     * @param key key whose associated value is to be returned as a boolean.     * @param def the value to be returned in the event that this     *        preference node has no value associated with <tt>key</tt>     *        or the associated value cannot be interpreted as a boolean,     *        or the backing store is inaccessible.     * @return the boolean value represented by the string associated with     *         <tt>key</tt> in this preference node, or <tt>def</tt> if the     *         associated value does not exist or cannot be interpreted as     *         a boolean.     * @throws IllegalStateException if this node (or an ancestor) has been     *         removed with the {@link #removeNode()} method.     * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.     * @see #get(String,String)     * @see #putBoolean(String,boolean)     */    public abstract boolean getBoolean(String key, boolean def);    /**     * Associates a string representing the specified float value with the     * specified key in this preference node.  The associated string is the     * one that would be returned if the float value were passed to     * {@link Float#toString(float)}.  This method is intended for use in     * conjunction with {@link #getFloat}.     *     * @param key key with which the string form of value is to be associated.     * @param value value whose string form is to be associated with key.     * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.     * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds     *         <tt>MAX_KEY_LENGTH</tt>.     * @throws IllegalStateException if this node (or an ancestor) has been     *         removed with the {@link #removeNode()} method.     * @see #getFloat(String,float)     */    public abstract void putFloat(String key, float value);    /**     * Returns the float value represented by the string associated with the     * specified key in this preference node.  The string is converted to an     * integer as by {@link Float#parseFloat(String)}.  Returns the specified     * default if there is no value associated with the key, the backing store     * is inaccessible, or if <tt>Float.parseFloat(String)</tt> would throw a     * {@link NumberFormatException} if the associated value were passed.     * This method is intended for use in conjunction with {@link #putFloat}.     *     * <p>If the implementation supports <i>stored defaults</i> and such a     * default exists, is accessible, and could be converted to a float     * with <tt>Float.parseFloat</tt>, this float is returned in preference to     * the specified default.     *     * @param key key whose associated value is to be returned as a float.     * @param def the value to be returned in the event that this     *        preference node has no value associated with <tt>key</tt>     *        or the associated value cannot be interpreted as a float,     *        or the backing store is inaccessible.     * @return the float value represented by the string associated with     *         <tt>key</tt> in this preference node, or <tt>def</tt> if the     *         associated value does not exist or cannot be interpreted as     *         a float.     * @throws IllegalStateException if this node (or an ancestor) has been     *         removed with the {@link #removeNode()} method.     * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.     * @see #putFloat(String,float)     * @see #get(String,String)     */    public abstract float getFloat(String key, float def);    /**     * Associates a string representing the specified double value with the     * specified key in this preference node.  The associated string is the     * one that would be returned if the double value were passed to     * {@link Double#toString(double)}.  This method is intended for use in     * conjunction with {@link #getDouble}.     *     * @param key key with which the string form of value is to be associated.     * @param value value whose string form is to be associated with key.     * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.     * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds     *         <tt>MAX_KEY_LENGTH</tt>.     * @throws IllegalStateException if this node (or an ancestor) has been     *         removed with the {@link #removeNode()} method.     * @see #getDouble(String,double)     */    public abstract void putDouble(String key, double value);    /**     * Returns the double value represented by the string associated with the     * specified key in this preference node.  The string is converted to an     * integer as by {@link Double#parseDouble(String)}.  Returns the specified     * default if there is no value associated with the key, the backing store     * is inaccessible, or if <tt>Double.parseDouble(String)</tt> would throw a     * {@link NumberFormatException} if the associated value were passed.     * This method is intended for use in conjunction with {@link #putDouble}.     *     * <p>If the implementation supports <i>stored defaults</i> and such a     * default exists, is accessible, and could be converted to a double     * with <tt>Double.parseDouble</tt>, this double is returned in preference     * to the specified default.     *     * @param key key whose associated value is to be returned as a double.     * @param def the value to be returned in the event that this     *        preference node has no value associated with <tt>key</tt>     *        or the associated value cannot be interpreted as a double,     *        or the backing store is inaccessible.     * @return the double value represented by the string associated with     *         <tt>key</tt> in this preference node, or <tt>def</tt> if the     *         associated value does not exist or cannot be interpreted as     *         a double.     * @throws IllegalStateException if this node (or an ancestor) has been     *         removed with the {@link #removeNode()} method.     * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.     * @see #putDouble(String,double)     * @see #get(String,String)     */    public abstract double getDouble(String key, double def);    /**     * Associates a string representing the specified byte array with the     * specified key in this preference node.  The associated string is     * the <i>Base64</i> encoding of the byte array, as defined in <a     * href=http://www.ietf.org/rfc/rfc2045.txt>RFC 2045</a>, Section 6.8,     * with one minor change: the string will consist solely of characters     * from the <i>Base64 Alphabet</i>; it will not contain any newline     * characters.  Note that the maximum length of the byte array is limited     * to three quarters of <tt>MAX_VALUE_LENGTH</tt> so that the length     * of the Base64 encoded String does not exceed <tt>MAX_VALUE_LENGTH</tt>.     * This method is intended for use in conjunction with     * {@link #getByteArray}.     *     * @param key key with which the string form of value is to be associated.     * @param value value whose string form is to be associated with key.     * @throws NullPointerException if key or value is <tt>null</tt>.     * @throws IllegalArgumentException if key.length() exceeds MAX_KEY_LENGTH     *         or if value.length exceeds MAX_VALUE_LENGTH*3/4.     * @throws IllegalStateException if this node (or an ancestor) has been     *         removed with the {@link #removeNode()} method.     * @see #getByteArray(String,byte[])     * @see #get(String,String)     */    public abstract void putByteArray(String key, byte[] value);    /**     * Returns the byte array value represented by the string associated with     * the specified key in this preference node.  Valid strings are     * <i>Base64</i> encoded binary data, as defined in <a     * href=http://www.ietf.org/rfc/rfc2045.txt>RFC 2045</a>, Section 6.8,      * with one minor change: the string must consist solely of characters     * from the <i>Base64 Alphabet</i>; no newline characters or     * extraneous characters are permitted.  This method is intended for use     * in conjunction with {@link #putByteArray}.     *     * <p>Returns the specified default if there is no value     * associated with the key, the backing store is inaccessible, or if the     * associated value is not a valid Base64 encoded byte array     * (as defined above).     *     * <p>If the implementation supports <i>stored defaults</i> and such a     * default exists and is accessible, it is used in preference to the     * specified default, unless the stored default is not a valid Base64     * encoded byte array (as defined above), in which case the     * specified default is used.     *     * @param key key whose associated value is to be returned as a byte array.     * @param def the value to be returned in the event that this     *        preference node has no value associated with <tt>key</tt>     *        or the associated value cannot be interpreted as a byte array,     *        or the backing store is inaccessible.     * @return the byte array value represented by the string associated with     *         <tt>key</tt> in this preference node, or <tt>def</tt> if the     *         associated value does not exist or cannot be interpreted as     *         a byte array.     * @throws IllegalStateException if this node (or an ancestor) has been     *         removed with the {@link #removeNode()} method.     * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.  (A      *         <tt>null</tt> value for <tt>def</tt> <i>is</i> permitted.)     * @see #get(String,String)     * @see #putByteArray(String,byte[])     */    public abstract byte[] getByteArray(String key, byte[] def);    /**     * Returns all of the keys that have an associated value in this     * preference node.  (The returned array will be of size zero if     * this node has no preferences.)     *     * <p>If the implementation supports <i>stored defaults</i> and there     * are any such defaults at this node that have not been overridden,     * by explicit preferences, the defaults are returned in the array in     * addition to any explicit preferences.     *     * @return an array of the keys that have an associated value in 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.     * @throws IllegalStateException if this node (or an ancestor) has been     *         removed with the {@link #removeNode()} method.     */    public abstract String[] keys() throws BackingStoreException;    /**     * Returns the names of the children of this preference node, relative to     * this node.  (The returned array will be of size zero if this node has     * no children.)     *     * @return 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.     * @throws IllegalStateException if this node (or an ancestor) has been     *         removed with the {@link #removeNode()} method.     */    public abstract String[] childrenNames() throws BackingStoreException;    /**     * Returns the parent of this preference node, or <tt>null</tt> if this is     * the root.     *     * @return the parent of this preference node.     * @throws IllegalStateException if this node (or an ancestor) has been     *         removed with the {@link #removeNode()} method.     */    public abstract Preferences parent();    /**      * Returns the named preference node in the same tree as this node,     * creating it and any of its ancestors if they do not already exist.     * Accepts a relative or absolute path name.  Relative path names     * (which do not begin with the slash character <tt>('/')</tt>) are     * interpreted relative to this preference node.     *     * <p>If the returned node did not exist prior to this call, this node and     * any ancestors that were created by this call are not guaranteed     * to become permanent until the <tt>flush</tt> method is called on     * the returned node (or one of its ancestors or descendants).     *     * @param pathName the path name of the preference node to return.     * @return the specified preference node.     * @throws IllegalArgumentException if the path name is invalid (i.e.,     *         it contains multiple consecutive slash characters, or ends     *         with a slash character and is more than one character long).     * @throws NullPointerException if path name is <tt>null</tt>.     * @throws IllegalStateException if this node (or an ancestor) has been     *         removed with the {@link #removeNode()} method.     * @see #flush()     */    public abstract Preferences node(String pathName);    /**      * Returns true if the named preference node exists in the same tree     * as this node.  Relative path names (which do not begin with the slash     * character <tt>('/')</tt>) are interpreted relative to this preference     * node.     *     * <p>If this node (or an ancestor) has already been removed with the      * {@link #removeNode()} method, it <i>is</i> legal to invoke this method,     * but only with the path name <tt>""</tt>; the invocation will return     * <tt>false</tt>.  Thus, the idiom <tt>p.nodeExists("")</tt> may be     * used to test whether <tt>p</tt> has been removed.     *     * @param pathName the path name of the node whose existence     *        is to be checked.     * @return true if the specified node exists.     * @throws BackingStoreException if this operation cannot be completed     *         due to a failure in the backing store, or inability to      *         communicate with it.     * @throws IllegalArgumentException if the path name is invalid (i.e.,     *         it contains multiple consecutive slash characters, or ends     *         with a slash character and is more than one character long).     * @throws NullPointerException if path name is <tt>null</tt>.s     * @throws IllegalStateException if this node (or an ancestor) has been     *         removed with the {@link #removeNode()} method and     *         <tt>pathName</tt> is not the empty string (<tt>""</tt>).     */    public abstract boolean nodeExists(String pathName)        throws BackingStoreException;    /** 

⌨️ 快捷键说明

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