processing.app.windows
Class Registry

java.lang.Object
  extended by processing.app.windows.Registry

public class Registry
extends java.lang.Object

Methods for accessing the Windows Registry. Only String and DWORD values supported at the moment.


Nested Class Summary
static class Registry.REGISTRY_ROOT_KEY
           
 
Constructor Summary
Registry()
           
 
Method Summary
static boolean createKey(Registry.REGISTRY_ROOT_KEY rootKey, java.lang.String parent, java.lang.String name)
          Create a new key.
static boolean deleteKey(Registry.REGISTRY_ROOT_KEY rootKey, java.lang.String parent, java.lang.String name)
          Delete a key.
static boolean deleteValue(Registry.REGISTRY_ROOT_KEY rootKey, java.lang.String subKeyName, java.lang.String name)
          Delete a value.
static int getIntValue(Registry.REGISTRY_ROOT_KEY rootKey, java.lang.String subKeyName, java.lang.String name)
          Read an int value.
static java.lang.String getStringValue(Registry.REGISTRY_ROOT_KEY rootKey, java.lang.String subKeyName, java.lang.String name)
          Read a String value.
static java.lang.String[] getSubKeys(Registry.REGISTRY_ROOT_KEY rootKey, java.lang.String parent)
          Get all sub keys of a key.
static java.util.TreeMap<java.lang.String,java.lang.Object> getValues(Registry.REGISTRY_ROOT_KEY rootKey, java.lang.String key)
          Get all values under a key.
static void main(java.lang.String[] args)
          Testing.
static boolean setIntValue(Registry.REGISTRY_ROOT_KEY rootKey, java.lang.String subKeyName, java.lang.String name, int value)
          Writes an int value.
static boolean setStringValue(Registry.REGISTRY_ROOT_KEY rootKey, java.lang.String subKeyName, java.lang.String name, java.lang.String value)
          Writes a String value.
static boolean valueExists(Registry.REGISTRY_ROOT_KEY rootKey, java.lang.String subKeyName, java.lang.String name)
          Check for existence of a value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Registry

public Registry()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Testing.

Parameters:
args - arguments
Throws:
java.lang.Exception - on error

getStringValue

public static java.lang.String getStringValue(Registry.REGISTRY_ROOT_KEY rootKey,
                                              java.lang.String subKeyName,
                                              java.lang.String name)
                                       throws java.io.UnsupportedEncodingException
Read a String value.

Parameters:
rootKey - root key
subKeyName - key name
name - value name
Returns:
String or null
Throws:
java.io.UnsupportedEncodingException - on error

getIntValue

public static int getIntValue(Registry.REGISTRY_ROOT_KEY rootKey,
                              java.lang.String subKeyName,
                              java.lang.String name)
Read an int value.

Parameters:
rootKey - root key
subKeyName - key name
name - value name
Returns:
int or 0

deleteValue

public static boolean deleteValue(Registry.REGISTRY_ROOT_KEY rootKey,
                                  java.lang.String subKeyName,
                                  java.lang.String name)
Delete a value.

Parameters:
rootKey - root key
subKeyName - key name
name - value name
Returns:
true on success

setStringValue

public static boolean setStringValue(Registry.REGISTRY_ROOT_KEY rootKey,
                                     java.lang.String subKeyName,
                                     java.lang.String name,
                                     java.lang.String value)
                              throws java.io.UnsupportedEncodingException
Writes a String value.

Parameters:
rootKey - root key
subKeyName - key name
name - value name
value - value
Returns:
true on success
Throws:
java.io.UnsupportedEncodingException - on error

setIntValue

public static boolean setIntValue(Registry.REGISTRY_ROOT_KEY rootKey,
                                  java.lang.String subKeyName,
                                  java.lang.String name,
                                  int value)
Writes an int value.

Parameters:
rootKey - root key
subKeyName - key name
name - value name
value - value
Returns:
true on success

valueExists

public static boolean valueExists(Registry.REGISTRY_ROOT_KEY rootKey,
                                  java.lang.String subKeyName,
                                  java.lang.String name)
Check for existence of a value.

Parameters:
rootKey - root key
subKeyName - key name
name - value name
Returns:
true if exists

createKey

public static boolean createKey(Registry.REGISTRY_ROOT_KEY rootKey,
                                java.lang.String parent,
                                java.lang.String name)
Create a new key.

Parameters:
rootKey - root key
parent - name of parent key
name - key name
Returns:
true on success

deleteKey

public static boolean deleteKey(Registry.REGISTRY_ROOT_KEY rootKey,
                                java.lang.String parent,
                                java.lang.String name)
Delete a key.

Parameters:
rootKey - root key
parent - name of parent key
name - key name
Returns:
true on success

getSubKeys

public static java.lang.String[] getSubKeys(Registry.REGISTRY_ROOT_KEY rootKey,
                                            java.lang.String parent)
Get all sub keys of a key.

Parameters:
rootKey - root key
parent - key name
Returns:
array with all sub key names

getValues

public static java.util.TreeMap<java.lang.String,java.lang.Object> getValues(Registry.REGISTRY_ROOT_KEY rootKey,
                                                                             java.lang.String key)
                                                                      throws java.io.UnsupportedEncodingException
Get all values under a key.

Parameters:
rootKey - root key
key - jey name
Returns:
TreeMap with name and value pairs
Throws:
java.io.UnsupportedEncodingException - on error