public class RegistryKey extends Handle
RegistryKeyValues
instance
obtained from the values()
method.Modifier and Type | Class and Description |
---|---|
static class |
RegistryKey.RegistryAccessMode
Provides enumeration of all registry access modes.
|
Modifier and Type | Field and Description |
---|---|
static RegistryKey |
CLASSES_ROOT
Windows registry base key HKEY_CLASSES_ROOT.
|
static RegistryKey |
CURRENT_CONFIG
Windows registry base key HKEY_CURRENT_CONFIG.
|
static RegistryKey |
CURRENT_USER
Windows registry base key HKEY_CURRENT_USER.
|
static RegistryKey |
DYN_DATA
Windows registry base key HKEY_DYN_DATA.
|
static RegistryKey |
LOCAL_MACHINE
Windows registry base key HKEY_LOCAL_MACHINE.
|
static RegistryKey |
PERFORMANCE_DATA
Windows registry base key HKEY_PERFORMANCE_DATA.
|
static int |
REG_NOTIFY_CHANGE_ATTRIBUTES |
static int |
REG_NOTIFY_CHANGE_LAST_SET |
static int |
REG_NOTIFY_CHANGE_NAME |
static int |
REG_NOTIFY_CHANGE_SECURITY |
static RegistryKey |
USERS
Windows registry base key HKEY_USERS.
|
INFINITE_TIMEOUT, INVALID_HANDLE_VALUE, STATUS_ABANDONED_WAIT_0, STATUS_TIMEOUT, STATUS_WAIT_0
Modifier and Type | Method and Description |
---|---|
void |
addRegistryEventListener(RegistryEventListener listener)
Adds RegistryKey event listener.
|
protected void |
checkError() |
protected void |
checkError(long errorCode) |
void |
close()
Closes the key and flushes it to disk if the contents have been modified.
|
RegistryKey |
copy(RegistryKey newBase,
java.lang.String newName,
boolean quietly)
Copies opened key to another base with new name.
|
RegistryKey |
createSubKey(java.lang.String subKey)
Creates a new subkey or opens an existing one.
|
RegistryKey |
createSubKey(java.lang.String subKey,
boolean writable)
Creates a new subkey or opens an existing one, with write access as
specified.
|
RegistryKey |
createSubKey(java.lang.String subKey,
boolean writable,
RegistryKey.RegistryAccessMode accessMode)
Creates a new subkey or opens an existing one, with write access as
specified.
|
RegistryKey |
createSubKey(java.lang.String subKey,
RegistryKey.RegistryAccessMode accessMode)
Creates a new subkey or opens an existing one, with write access as
specified.
|
void |
deleteSubKey(java.lang.String subKey)
Deletes the specified subkey is it doesn't include any subkeys.
|
void |
deleteSubKey(java.lang.String subKey,
RegistryKey.RegistryAccessMode accessMode)
Deletes the specified subkey is it doesn't include any subkeys.
|
void |
deleteSubTree(java.lang.String subKey)
Deletes the specified subkey and all its subkeys.
|
boolean |
equals(java.lang.Object obj)
Determines whether two Object instances are equal.
|
boolean |
exists(java.lang.String name)
Checks if the specified subkey exists and can be opened.
|
boolean |
exists(java.lang.String name,
RegistryKey.RegistryAccessMode accessMode)
Checks if the specified subkey exists and can be opened.
|
protected void |
fireRegistryEvent(java.util.EventObject event)
Notifies listeners about RegistryKey event.
|
void |
flush()
Writes all the attributes of the specified open RegistryKey into the
registry.
|
java.lang.String |
getAbsolutePath()
Returns absolute path of the key.
|
Handle |
getHandle()
Deprecated.
use
this instead of this function |
java.lang.String |
getName()
Retrieves the name of the key.
|
java.lang.String |
getPath()
Returns the path of the key.
|
RegistryKey.RegistryAccessMode |
getRegistryAccessMode()
Returns current registry access mode.
|
RegistryKey |
getRootKey()
Returns the Root of this registry key.
|
int |
getSubKeyCount()
Retrieves the count of subkeys at the base level for the current key.
|
java.util.List |
getSubKeyNames()
Retrieves List of strings that contains all the subkey names.
|
java.util.List |
getSubkeys()
Returns a list of RegistryKey that are subkeys of the current
RegistryKey.
|
int |
hashCode() |
RegistryKey |
openSubKey(java.lang.String name)
Opens a subkey by the specified name (as read-only).
|
RegistryKey |
openSubKey(java.lang.String name,
boolean writable)
Opens a subkey by the specified name.
|
RegistryKey |
openSubKey(java.lang.String name,
boolean writable,
boolean quietly)
Opens a subkey by the specified name.
|
RegistryKey |
openSubKey(java.lang.String name,
boolean writable,
boolean quietly,
RegistryKey.RegistryAccessMode accessMode)
Opens a subkey by the specified name.
|
RegistryKey |
openSubKey(java.lang.String name,
boolean writable,
RegistryKey.RegistryAccessMode accessMode)
Opens a subkey by the specified name.
|
RegistryKey |
openSubKey(java.lang.String name,
RegistryKey.RegistryAccessMode accessMode)
Opens a subkey by the specified name.
|
void |
removeRegistryEventListener(RegistryEventListener listener)
Removes RegistryKey event listener.
|
void |
rename(java.lang.String newName)
Renames opened registry key.
|
void |
startChangeListening()
Starts listening for changes in the RegistryKey.
|
void |
startChangeListening(boolean watchSubtree,
int filter)
Starts listening for changes in the RegistryKey.
|
void |
stopChangeListening()
Stops listening for events in the RegistryKey.
|
java.lang.String |
toString() |
RegistryKeyValues |
values()
Returns RegistryKeyValues.
|
clone, closeHandle, waitFor, waitFor
asFunction, asFunction, asTypedPointer, castTo, castTo, getDebugInfo, getLength, getValue, isNull, read, setValue, write
public static final RegistryKey CLASSES_ROOT
public static final RegistryKey CURRENT_USER
public static final RegistryKey LOCAL_MACHINE
public static final RegistryKey USERS
public static final RegistryKey PERFORMANCE_DATA
public static final RegistryKey CURRENT_CONFIG
public static final RegistryKey DYN_DATA
public static final int REG_NOTIFY_CHANGE_NAME
public static final int REG_NOTIFY_CHANGE_ATTRIBUTES
public static final int REG_NOTIFY_CHANGE_LAST_SET
public static final int REG_NOTIFY_CHANGE_SECURITY
public RegistryKey.RegistryAccessMode getRegistryAccessMode()
public java.lang.String getName()
public java.lang.String getPath()
public java.lang.String getAbsolutePath()
protected void checkError()
protected void checkError(long errorCode)
public int getSubKeyCount()
public void close()
public RegistryKey createSubKey(java.lang.String subKey, boolean writable)
subKey
- the name of the subkey to create.writable
- set to true if you need write access to the key.public RegistryKey createSubKey(java.lang.String subKey, RegistryKey.RegistryAccessMode accessMode)
subKey
- the name of the subkey to create.accessMode
- specifies registry access mode.public RegistryKey createSubKey(java.lang.String subKey, boolean writable, RegistryKey.RegistryAccessMode accessMode)
subKey
- the name of the subkey to create.writable
- set to true if you need write access to the key.accessMode
- specifies registry access mode.public RegistryKey createSubKey(java.lang.String subKey)
subKey
- a sub-key path string.public void deleteSubKey(java.lang.String subKey)
deleteSubTree(java.lang.String)
.subKey
- the name of the subkey to delete.public void deleteSubKey(java.lang.String subKey, RegistryKey.RegistryAccessMode accessMode)
deleteSubTree(java.lang.String)
.subKey
- the name of the subkey to delete.accessMode
- specifies registry access mode.public void deleteSubTree(java.lang.String subKey)
subKey
- the name of the subkey to delete.public void rename(java.lang.String newName)
newName
- public RegistryKey getRootKey()
public boolean equals(java.lang.Object obj)
public int hashCode()
hashCode
in class com.jniwrapper.Pointer.Void
public void flush()
public java.util.List getSubKeyNames()
public java.lang.String toString()
toString
in class com.jniwrapper.Pointer.Void
public RegistryKey openSubKey(java.lang.String name)
name
- the name of the subkey to open.RegistryException
- if a sub key cannot be opened.public RegistryKey openSubKey(java.lang.String name, boolean writable)
name
- the name of the subkey to open.writable
- set to true if you need write access to the key.RegistryException
- if a sub key cannot be opened.public RegistryKey openSubKey(java.lang.String name, boolean writable, boolean quietly)
name
- the name of the subkey to open.writable
- set to true if you need write access to the key.quietly
- if true, instructs the function not to throw
RegistryException if there is an error during opening the key; if false,
the exception is thrown.RegistryException
- if a sub key cannot be opened and parameter
is false.public RegistryKey openSubKey(java.lang.String name, boolean writable, boolean quietly, RegistryKey.RegistryAccessMode accessMode)
name
- the name of the subkey to open.writable
- set to true if you need write access to the key.quietly
- if true, instructs the function not to throw
RegistryException if there is an error during opening the key; if false,
the exception is thrown.accessMode
- specifies registry access modeRegistryException
- if a sub key cannot be opened and parameter
is false.public RegistryKey openSubKey(java.lang.String name, boolean writable, RegistryKey.RegistryAccessMode accessMode)
name
- the name of the subkey to open.writable
- set to true if you need write access to the key.accessMode
- specifies registry access modeRegistryException
- if a sub key cannot be opened and parameter
is false.public RegistryKey openSubKey(java.lang.String name, RegistryKey.RegistryAccessMode accessMode)
name
- the name of the subkey to open.accessMode
- specifies registry access modeRegistryException
- if a sub key cannot be opened and parameter
is false.public boolean exists(java.lang.String name)
name
- the name of the subkey to check.public boolean exists(java.lang.String name, RegistryKey.RegistryAccessMode accessMode)
name
- the name of the subkey to check.accessMode
- specifies registry access modepublic RegistryKey copy(RegistryKey newBase, java.lang.String newName, boolean quietly)
newBase
- is a target registry base or null
to leave key in the current base.newName
- is a target key name.quietly
- if true, instructs the function not to throw
RegistryException if there the specified key already exists; if false,
the exception is thrown.public java.util.List getSubkeys()
public RegistryKeyValues values()
public Handle getHandle()
this
instead of this functionpublic void addRegistryEventListener(RegistryEventListener listener)
listener
- public void removeRegistryEventListener(RegistryEventListener listener)
listener
- protected void fireRegistryEvent(java.util.EventObject event)
event
- public void startChangeListening(boolean watchSubtree, int filter)
watchSubtree
- filter
- public void startChangeListening()
public void stopChangeListening()