org.boris.winrun4j
Class RegistryKey

java.lang.Object
  extended byorg.boris.winrun4j.RegistryKey

public class RegistryKey
extends java.lang.Object

A class that wraps a registry key.


Field Summary
static RegistryKey HKEY_CLASSES_ROOT
           
static RegistryKey HKEY_CURRENT_CONFIG
           
static RegistryKey HKEY_CURRENT_USER
           
static RegistryKey HKEY_LOCAL_MACHINE
           
static RegistryKey HKEY_USERS
           
static int TYPE_BINARY
           
static int TYPE_DWORD
           
static int TYPE_DWORD_BIG_ENDIAN
           
static int TYPE_DWORD_LITTLE_ENDIAN
           
static int TYPE_EXPAND_SZ
           
static int TYPE_LINK
           
static int TYPE_MULTI_SZ
           
static int TYPE_NONE
           
static int TYPE_QWORD
           
static int TYPE_QWORD_LITTLE_ENDIAN
           
static int TYPE_SZ
           
 
Constructor Summary
RegistryKey(RegistryKey parent, java.lang.String path)
          Creates a new RegistryKey object.
RegistryKey(RegistryKey parent, java.lang.String[] path)
          Creates a new RegistryKey object.
 
Method Summary
static void closeKeyHandle(long handle)
          Close a key.
static long createSubKey(long handle, java.lang.String key)
          Creates a sub key.
 RegistryKey createSubKey(java.lang.String name)
          Creates a sub key.
static void deleteSubKey(long handle, java.lang.String key)
          Deletes the sub key.
 void deleteSubKey(java.lang.String subKey)
          Deletes the sub key.
static void deleteValue(long parent, java.lang.String name)
          Delets the key.
 void deleteValue(java.lang.String name)
          Deletes the value.
 boolean exists()
          Indicates if this registry key exists.
static byte[] getBinary(long parent, java.lang.String name)
          Gets the value.
 byte[] getBinary(java.lang.String name)
          Gets a binary value.
static long getDoubleWord(long parent, java.lang.String name)
          Gets the value.
 long getDoubleWord(java.lang.String name)
          Gets a DWORD.
static java.lang.String getExpandedString(long parent, java.lang.String name)
          Gets the value.
 java.lang.String getExpandedString(java.lang.String name)
          Gets a value.
static java.lang.String[] getMultiString(long parent, java.lang.String name)
          Gets the value.
 java.lang.String[] getMultiString(java.lang.String name)
          Gets a value.
 RegistryKey getParent()
          Gets the parent key.
 java.lang.String[] getPath()
          Gets the path of the key.
static RegistryKey getRootKey(java.lang.String name)
           
static java.lang.String getString(long parent, java.lang.String name)
          Gets the value.
 java.lang.String getString(java.lang.String name)
          Gets a string.
 RegistryKey getSubKey(java.lang.String name)
          Gets a subkey of a particular name (or null).
 java.lang.String[] getSubKeyNames()
          Gets the subkeys for this key.
static java.lang.String[] getSubKeyNames(long handle)
          Get the sub key names.
static long getType(long parent, java.lang.String name)
          Gets the name.
 long getType(java.lang.String name)
          Gets the type of a value.
 java.lang.String[] getValueNames()
          Gets the values for this key.
static java.lang.String[] getValueNames(long handle)
          Gets the values.
static long openKeyHandle(long rootKey, java.lang.String keyPath, boolean readOnly)
          Create a key handle.
static void setBinary(long parent, java.lang.String name, byte[] value)
          Sets the value.
 void setBinary(java.lang.String name, byte[] value)
          Sets a value.
static void setDoubleWord(long parent, java.lang.String name, long dword)
          Sets the value.
 void setDoubleWord(java.lang.String name, long value)
          Sets the value.
static void setMultiString(long parent, java.lang.String name, java.lang.String[] value)
          Sets the value.
 void setMultiString(java.lang.String name, java.lang.String[] value)
          Sets the value.
static void setString(long parent, java.lang.String name, java.lang.String value)
          Sets the value.
 void setString(java.lang.String name, java.lang.String value)
          Sets a value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HKEY_CLASSES_ROOT

public static final RegistryKey HKEY_CLASSES_ROOT

HKEY_CURRENT_USER

public static final RegistryKey HKEY_CURRENT_USER

HKEY_LOCAL_MACHINE

public static final RegistryKey HKEY_LOCAL_MACHINE

HKEY_USERS

public static final RegistryKey HKEY_USERS

HKEY_CURRENT_CONFIG

public static final RegistryKey HKEY_CURRENT_CONFIG

TYPE_NONE

public static final int TYPE_NONE
See Also:
Constant Field Values

TYPE_SZ

public static final int TYPE_SZ
See Also:
Constant Field Values

TYPE_EXPAND_SZ

public static final int TYPE_EXPAND_SZ
See Also:
Constant Field Values

TYPE_BINARY

public static final int TYPE_BINARY
See Also:
Constant Field Values

TYPE_DWORD

public static final int TYPE_DWORD
See Also:
Constant Field Values

TYPE_DWORD_LITTLE_ENDIAN

public static final int TYPE_DWORD_LITTLE_ENDIAN
See Also:
Constant Field Values

TYPE_DWORD_BIG_ENDIAN

public static final int TYPE_DWORD_BIG_ENDIAN
See Also:
Constant Field Values

TYPE_LINK

public static final int TYPE_LINK
See Also:
Constant Field Values

TYPE_MULTI_SZ

public static final int TYPE_MULTI_SZ
See Also:
Constant Field Values

TYPE_QWORD

public static final int TYPE_QWORD
See Also:
Constant Field Values

TYPE_QWORD_LITTLE_ENDIAN

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

RegistryKey

public RegistryKey(RegistryKey parent,
                   java.lang.String path)
Creates a new RegistryKey object.


RegistryKey

public RegistryKey(RegistryKey parent,
                   java.lang.String[] path)
Creates a new RegistryKey object.

Method Detail

getRootKey

public static RegistryKey getRootKey(java.lang.String name)

exists

public boolean exists()
Indicates if this registry key exists.


getSubKeyNames

public java.lang.String[] getSubKeyNames()
Gets the subkeys for this key.

Returns:
String[].

getSubKey

public RegistryKey getSubKey(java.lang.String name)
Gets a subkey of a particular name (or null).

Returns:
RegistryKey.

createSubKey

public RegistryKey createSubKey(java.lang.String name)
Creates a sub key.

Parameters:
name -
Returns:
RegistryKey.

getValueNames

public java.lang.String[] getValueNames()
Gets the values for this key.

Returns:
String[].

getPath

public java.lang.String[] getPath()
Gets the path of the key.

Returns:
String.

getParent

public RegistryKey getParent()
Gets the parent key.

Returns:
RegistryKey.

deleteSubKey

public void deleteSubKey(java.lang.String subKey)
Deletes the sub key.


getType

public long getType(java.lang.String name)
Gets the type of a value.

Returns:
int.

getString

public java.lang.String getString(java.lang.String name)
Gets a string.


getBinary

public byte[] getBinary(java.lang.String name)
Gets a binary value.

Returns:
byte[].

getDoubleWord

public long getDoubleWord(java.lang.String name)
Gets a DWORD.

Returns:
long.

getExpandedString

public java.lang.String getExpandedString(java.lang.String name)
Gets a value.

Returns:
String.

getMultiString

public java.lang.String[] getMultiString(java.lang.String name)
Gets a value.

Returns:
String[].

setString

public void setString(java.lang.String name,
                      java.lang.String value)
Sets a value.


setBinary

public void setBinary(java.lang.String name,
                      byte[] value)
Sets a value.


setDoubleWord

public void setDoubleWord(java.lang.String name,
                          long value)
Sets the value.


setMultiString

public void setMultiString(java.lang.String name,
                           java.lang.String[] value)
Sets the value.


deleteValue

public void deleteValue(java.lang.String name)
Deletes the value.


openKeyHandle

public static long openKeyHandle(long rootKey,
                                 java.lang.String keyPath,
                                 boolean readOnly)
Create a key handle.

Parameters:
rootKey -
Returns:
long.

closeKeyHandle

public static void closeKeyHandle(long handle)
Close a key.


getSubKeyNames

public static java.lang.String[] getSubKeyNames(long handle)
Get the sub key names.

Returns:
long[].

getValueNames

public static java.lang.String[] getValueNames(long handle)
Gets the values.

Returns:
String[].

createSubKey

public static long createSubKey(long handle,
                                java.lang.String key)
Creates a sub key.


deleteSubKey

public static void deleteSubKey(long handle,
                                java.lang.String key)
Deletes the sub key.


getType

public static long getType(long parent,
                           java.lang.String name)
Gets the name.

Returns:
long.

deleteValue

public static void deleteValue(long parent,
                               java.lang.String name)
Delets the key.


getString

public static java.lang.String getString(long parent,
                                         java.lang.String name)
Gets the value.

Returns:
String.

getBinary

public static byte[] getBinary(long parent,
                               java.lang.String name)
Gets the value.

Returns:
byte[].

getDoubleWord

public static long getDoubleWord(long parent,
                                 java.lang.String name)
Gets the value.

Returns:
long.

getExpandedString

public static java.lang.String getExpandedString(long parent,
                                                 java.lang.String name)
Gets the value.

Returns:
String.

getMultiString

public static java.lang.String[] getMultiString(long parent,
                                                java.lang.String name)
Gets the value.

Returns:
String[].

setString

public static void setString(long parent,
                             java.lang.String name,
                             java.lang.String value)
Sets the value.


setBinary

public static void setBinary(long parent,
                             java.lang.String name,
                             byte[] value)
Sets the value.


setDoubleWord

public static void setDoubleWord(long parent,
                                 java.lang.String name,
                                 long dword)
Sets the value.


setMultiString

public static void setMultiString(long parent,
                                  java.lang.String name,
                                  java.lang.String[] value)
Sets the value.