Build 1.0_r1(from source)

android.os
Class SystemProperties

java.lang.Object
  extended by android.os.SystemProperties

public class SystemProperties
extends Object

Gives access to the system properties store. The system properties store contains a list of string key-value pairs.


Field Summary
static int PROP_NAME_MAX
           
static int PROP_VALUE_MAX
           
 
Constructor Summary
SystemProperties()
           
 
Method Summary
static String get(String key)
          Get the value for the given key.
static String get(String key, String def)
          Get the value for the given key.
static boolean getBoolean(String key, boolean def)
          Get the value for the given key, returned as a boolean.
static int getInt(String key, int def)
          Get the value for the given key, and return as an integer.
static long getLong(String key, long def)
          Get the value for the given key, and return as a long.
static void set(String key, String val)
          Set the value for the given key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_NAME_MAX

public static final int PROP_NAME_MAX
See Also:
Constant Field Values

PROP_VALUE_MAX

public static final int PROP_VALUE_MAX
See Also:
Constant Field Values
Constructor Detail

SystemProperties

public SystemProperties()
Method Detail

get

public static String get(String key)
Get the value for the given key.

Returns:
an empty string if the key isn't found
Throws:
IllegalArgumentException - if the key exceeds 32 characters

get

public static String get(String key,
                         String def)
Get the value for the given key.

Returns:
if the key isn't found, return def if it isn't null, or an empty string otherwise
Throws:
IllegalArgumentException - if the key exceeds 32 characters

getInt

public static int getInt(String key,
                         int def)
Get the value for the given key, and return as an integer.

Parameters:
key - the key to lookup
def - a default value to return
Returns:
the key parsed as an integer, or def if the key isn't found or cannot be parsed
Throws:
IllegalArgumentException - if the key exceeds 32 characters

getLong

public static long getLong(String key,
                           long def)
Get the value for the given key, and return as a long.

Parameters:
key - the key to lookup
def - a default value to return
Returns:
the key parsed as a long, or def if the key isn't found or cannot be parsed
Throws:
IllegalArgumentException - if the key exceeds 32 characters

getBoolean

public static boolean getBoolean(String key,
                                 boolean def)
Get the value for the given key, returned as a boolean. Values 'n', 'no', '0', 'false' or 'off' are considered false. Values 'y', 'yes', '1', 'true' or 'on' are considered true. (case insensitive). If the key does not exist, or has any other value, then the default result is returned.

Parameters:
key - the key to lookup
def - a default value to return
Returns:
the key parsed as a boolean, or def if the key isn't found or is not able to be parsed as a boolean.
Throws:
IllegalArgumentException - if the key exceeds 32 characters

set

public static void set(String key,
                       String val)
Set the value for the given key.

Throws:
IllegalArgumentException - if the key exceeds 32 characters
IllegalArgumentException - if the value exceeds 92 characters

Build 1.0_r1(from source)

Please submit a feedback, bug or feature