WindowsRegistry

processing.app.platform

## Class WindowsRegistry

- Object
- - WindowsRegistry

-     public class WindowsRegistry
      extends Object

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

  Not sure where this code came from originally (if you know the reference, please get in touch so that we can add a proper citation). Several changes were made to update it for JNA 3.5.2's platform classes and clean up the syntax to make it less like a C program. [fry 130720]

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `WindowsRegistry.REGISTRY_ROOT_KEY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WindowsRegistry()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `createKey(WindowsRegistry.REGISTRY_ROOT_KEY rootKey, String parent, String name)` Create a new key.
    `static boolean` | `deleteKey(WindowsRegistry.REGISTRY_ROOT_KEY rootKey, String parent, String name)` Delete a key.
    `static boolean` | `deleteValue(WindowsRegistry.REGISTRY_ROOT_KEY rootKey, String subKeyName, String name)` Delete a value.
    `static int` | `getIntValue(WindowsRegistry.REGISTRY_ROOT_KEY rootKey, String subKeyName, String name)` Read an int value.
    `static String` | `getStringValue(WindowsRegistry.REGISTRY_ROOT_KEY rootKey, String subKeyName, String name)` Read a String value.
    `static String[]` | `getSubKeys(WindowsRegistry.REGISTRY_ROOT_KEY rootKey, String parent)` Get all sub keys of a key.
    `static TreeMap<String,Object>` | `getValues(WindowsRegistry.REGISTRY_ROOT_KEY rootKey, String key)` Get all values under a key.
    `static boolean` | `setIntValue(WindowsRegistry.REGISTRY_ROOT_KEY rootKey, String subKeyName, String name, int value)` Writes an int value.
    `static boolean` | `setStringValue(WindowsRegistry.REGISTRY_ROOT_KEY rootKey, String subKeyName, String name, String value)` Writes a String value.
    `static boolean` | `valueExists(WindowsRegistry.REGISTRY_ROOT_KEY rootKey, String subKeyName, String name)` Check for existence of a value.

    - ### Methods inherited from class Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### WindowsRegistry

          public WindowsRegistry()

  - ### Method Detail

    - #### getStringValue

          public static String getStringValue(WindowsRegistry.REGISTRY_ROOT_KEY rootKey,
                              String subKeyName,
                              String name)
                                       throws UnsupportedEncodingException

      Read a String value.
      Parameters:
        `rootKey` - root key
        `subKeyName` - key name
        `name` - value name
      Returns:
        String or null
      Throws:
        `UnsupportedEncodingException` - on error

    - #### getIntValue

          public static int getIntValue(WindowsRegistry.REGISTRY_ROOT_KEY rootKey,
                        String subKeyName,
                        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(WindowsRegistry.REGISTRY_ROOT_KEY rootKey,
                            String subKeyName,
                            String name)

      Delete a value.
      Parameters:
        `rootKey` - root key
        `subKeyName` - key name
        `name` - value name
      Returns:
        true on success

    - #### setStringValue

          public static boolean setStringValue(WindowsRegistry.REGISTRY_ROOT_KEY rootKey,
                               String subKeyName,
                               String name,
                               String value)
                                        throws UnsupportedEncodingException

      Writes a String value.
      Parameters:
        `rootKey` - root key
        `subKeyName` - key name
        `name` - value name
        `value` - value
      Returns:
        true on success
      Throws:
        `UnsupportedEncodingException` - on error

    - #### setIntValue

          public static boolean setIntValue(WindowsRegistry.REGISTRY_ROOT_KEY rootKey,
                            String subKeyName,
                            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(WindowsRegistry.REGISTRY_ROOT_KEY rootKey,
                            String subKeyName,
                            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(WindowsRegistry.REGISTRY_ROOT_KEY rootKey,
                          String parent,
                          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(WindowsRegistry.REGISTRY_ROOT_KEY rootKey,
                          String parent,
                          String name)

      Delete a key.
      Parameters:
        `rootKey` - root key
        `parent` - name of parent key
        `name` - key name
      Returns:
        true on success

    - #### getSubKeys

          public static String[] getSubKeys(WindowsRegistry.REGISTRY_ROOT_KEY rootKey,
                            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 TreeMap<String,Object> getValues(WindowsRegistry.REGISTRY_ROOT_KEY rootKey,
                                         String key)
                                                  throws UnsupportedEncodingException

      Get all values under a key.
      Parameters:
        `rootKey` - root key
        `key` - jey name
      Returns:
        TreeMap with name and value pairs
      Throws:
        `UnsupportedEncodingException` - on error