📄 preferences.java
字号:
* the backing store supports <tt>long</tt> values, it is not unreasonable to * use them. This implementation detail is not visible through the * <Tt>Preferences</Tt> API, which allows the value to be read as a <tt>long</tt> * (with <tt>getLong</tt> or a <tt>String</tt> (with <tt>get</tt>) type. * * @param key <tt>key</tt> with which the string form of <tt>value</tt> is to be associated. * @param value <tt>value</tt> whose string form is to be associated with <tt>key</tt>. * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()}method. * @see #getLong(String,long) */ public abstract void putLong(String key, long value); /** * Returns the <tt>long</tt> value represented by the <tt>String</tt> object associated with the * specified <tt>key</tt> in this node. The <tt>String</tt> object is converted to * a <tt>long</tt> as by <tt>Long.parseLong(String)</tt>. Returns the * specified default if there is no value associated with the <tt>key</tt>, * the backing store is inaccessible, or if * <tt>Long.parseLong(String)</tt> would throw a * <tt>NumberFormatException</tt> if the associated * <tt>value</tt> were passed. This * method is intended for use in conjunction with the {@link #putLong}method. * * @param key <tt>key</tt> whose associated value is to be returned as a <tt>long</tt> value. * @param def the value to be returned in the event that this * node has no value associated with <tt>key</tt> * or the associated value cannot be interpreted as a <tt>long</tt> type * or the backing store is inaccessible. * @return the <tt>long</tt> value represented by the <tt>String</tt> object associated with * <tt>key</tt> in this node, or <tt>def</tt> if the * associated value does not exist or cannot be interpreted as * a <tt>long</tt> type. * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()}method. * @see #putLong(String,long) * @see #get(String,String) */ public abstract long getLong(String key, long def); /** * Associates a <tt>String</tt> object representing the specified <tt>boolean</tt> value with the * specified key in this node. The associated string is * "true" if the value is <tt>true</tt>, and "false" if it is * <tt>false</tt>. This method is intended for use in conjunction with * the {@link #getBoolean}method. * * <p>Implementor's note: it is <i>not</i> necessary that the * value be represented by a string in the backing store. If * the backing store supports <tt>boolean</tt> values, it is not unreasonable to * use them. This implementation detail is not visible through the * <Tt>Preferences</Tt> API, which allows the value to be read as a * <tt>boolean</tt> (with <tt>getBoolean</tt>) or a <tt>String</tt> (with <tt>get</tt>) type. * * @param key <tt>key</tt> with which the string form of value is to be associated. * @param value value whose string form is to be associated with <tt>key</tt>. * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()}method. * @see #getBoolean(String,boolean) * @see #get(String,String) */ public abstract void putBoolean(String key, boolean value); /** * Returns the <tt>boolean</tt> value represented by the <tt>String</tt> object associated with the * specified <tt>key</tt> in this node. Valid strings * are "true", which represents <tt>true</tt>, and "false", which * represents <tt>false</tt>. Case is ignored, so, for example, "TRUE" * and "False" are also valid. This method is intended for use in * conjunction with the {@link #putBoolean}method. * * <p>Returns the specified default if there is no value * associated with the <tt>key</tt>, the backing store is inaccessible, or if the * associated value is something other than "true" or * "false", ignoring case. * * @param key <tt>key</tt> whose associated value is to be returned as a <tt>boolean</tt>. * @param def the value to be returned in the event that this * node has no value associated with <tt>key</tt> * or the associated value cannot be interpreted as a <tt>boolean</tt> * or the backing store is inaccessible. * @return the <tt>boolean</tt> value represented by the <tt>String</tt> object associated with * <tt>key</tt> in this node, or <tt>null</tt> if the * associated value does not exist or cannot be interpreted as * a <tt>boolean</tt>. * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()}method. * @see #get(String,String) * @see #putBoolean(String,boolean) */ public abstract boolean getBoolean(String key, boolean def); /** * Associates a <tt>String</tt> object representing the specified <tt>float</tt> value with the * specified <tt>key</tt> in this node. The associated <tt>String</tt> object is the * one that would be returned if the <tt>float</tt> value were passed to * <tt>Float.toString(float)</tt>. This method is intended for use in * conjunction with the {@link #getFloat}method. * * <p>Implementor's note: it is <i>not</i> necessary that the * value be represented by a string in the backing store. If * the backing store supports <tt>float</tt> values, it is not unreasonable to * use them. This implementation detail is not visible through the * <Tt>Preferences</Tt> API, which allows the value to be read as a * <tt>float</tt> (with <tt>getFloat</tt>) or a <tt>String</tt> (with <tt>get</tt>) type. * * @param key <tt>key</tt> with which the string form of value is to be associated. * @param value value whose string form is to be associated with <tt>key</tt>. * @throws NullPointerException if <tt>key</tt> is <tt>null</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 <tt>value</tt> represented by the <tt>String</tt> object associated with the * specified <tt>key</tt> in this node. The <tt>String</tt> object is converted to an * <tt>int</tt> value as by <tt>Float.parseFloat(String)</tt>. Returns the specified * default if there is no value associated with the <tt>key</tt>, the backing store * is inaccessible, or if <tt>Float.parseFloat(String)</tt> would throw a * <tt>NumberFormatException</tt> if the associated value were passed. * This method is intended for use in conjunction with the {@link #putFloat}method. * * @param key <tt>key</tt> whose associated value is to be returned as a <tt>float</tt> value. * @param def the value to be returned in the event that this * node has no value associated with <tt>key</tt> * or the associated value cannot be interpreted as a <tt>float</tt> type * or the backing store is inaccessible. * @return the <tt>float</tt> value represented by the string associated with * <tt>key</tt> in this node, or <tt>def</tt> if the * associated value does not exist or cannot be interpreted as * a <tt>float</tt> type. * @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 <tt>String</tt> object representing the specified <tt>double</tt> value with the * specified <tt>key</tt> in this node. The associated <tt>String</tt> object is the * one that would be returned if the <tt>double</tt> value were passed to * <tt>Double.toString(double)</tt>. This method is intended for use in * conjunction with the {@link #getDouble}method * * <p>Implementor's note: it is <i>not</i> necessary that the * value be represented by a string in the backing store. If * the backing store supports <tt>double</tt> values, it is not unreasonable to * use them. This implementation detail is not visible through the * <Tt>Preferences</Tt> API, which allows the value to be read as a * <tt>double</tt> (with <tt>getDouble</tt>) or a <tt>String</tt> (with <tt>get</tt>) type. * * @param key <tt>key</tt> with which the string form of value is to be associated. * @param value value whose string form is to be associated with <tt>key</tt>. * @throws NullPointerException if <tt>key</tt> is <tt>null</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 <tt>double</tt> value represented by the <tt>String</tt> object associated with the * specified <tt>key</tt> in this node. The <tt>String</tt> object is converted to an * <tt>int</tt> value as by <tt>Double.parseDouble(String)</tt>. * Returns the specified * default if there is no value associated with the <tt>key</tt>, the backing store * is inaccessible, or if <tt>Double.parseDouble(String)</tt> would throw a * <tt>NumberFormatException</tt> if the associated value were passed. * This method is intended for use in conjunction with the {@link #putDouble} method. * * @param key <tt>key</tt> whose associated value is to be returned as a <tt>double</tt> value. * @param def the value to be returned in the event that this * node has no value associated with <tt>key</tt> * or the associated value cannot be interpreted as a <tt>double</tt> type * or the backing store is inaccessible. * @return the <tt>double</tt> value represented by the <tt>String</tt> object associated with * <tt>key</tt> in this node, or <tt>def</tt> if the * associated value does not exist or cannot be interpreted as * a <tt>double</tt> type. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the 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 <tt>String</tt> object representing the specified <tt>byte[]</tt> with the * specified <tt>key</tt> in this node. The associated <tt>String</tt> object * the <i>Base64</i> encoding of the <tt>byte[]</tt>, 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. * This method is intended for use in conjunction with * the {@link #getByteArray}method. * * <p>Implementor's note: it is <i>not</i> necessary that the * value be represented by a <tt>String</tt> type in the backing store. If * the backing store supports <tt>byte[]</tt> values, it is not unreasonable to * use them. This implementation detail is not visible through the * <Tt>Preferences</Tt> API, which allows the value to be read as an * a <tt>byte[]</tt> object (with <tt>getByteArray</tt>) or a <tt>String</tt> object * (with <tt>get</tt>). * * @param key <tt>key</tt> with which the string form of <tt>value</tt> is to be associated. * @param value <tt>value</tt> whose string form is to be associated with <tt>key</tt>. * @throws NullPointerException if <tt>key</tt> or <tt>value</tt> * is <tt>null</tt>. * @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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -