public final class RegistryWatcher extends Object
This class provides the functionality to watch for registry key changes.
To start monitoring changes, a class would first implement
the RegistryListener
class. A call to
addRegistryListener(com.registry.event.RegistryListener)
would then register that
listener so that registry key changes will be sent to it.
After that, just add registry keys to monitor via the
watchKey(RegistryKey)
method or remove registry keys
to stop monitoring them with the removeKey(RegistryKey)
method.
Modifier and Type | Method and Description |
---|---|
static void |
addRegistryListener(RegistryListener l)
Registers a listener to receive registry key changes.
|
static void |
removeID(int id)
Removes the registry key with the corresponding watch id
from the list of watched keys.
|
static void |
removeKey(RegistryKey key)
Removes
key from the list of watched
keys. |
static void |
removeRegistryListener(RegistryListener l)
Unregisters the listener so that it will not longer receive
registry key changes.
|
static int |
watchKey(RegistryKey key)
Adds the specified registry key to the watch list.
|
static int |
watchKey(RegistryKey key,
boolean watchSubtree)
Adds the specified registry key to the watch list.
|
static int |
watchKey(RegistryKey key,
boolean watchSubtree,
int dwNotifyFilter)
Adds the specified registry key to the watch list.
|
public static void addRegistryListener(RegistryListener l)
l
- the listener that will receive the changes.public static void removeRegistryListener(RegistryListener l)
l
- the listener to unregister.public static int watchKey(RegistryKey key)
key
- the registry key to watch.RegistryException
- if at least one listener is not registered.public static int watchKey(RegistryKey key, boolean watchSubtree)
key
- the registry key to watch.watchSubtree
- whether or not changes in the subtree
should be reported.RegistryException
- if at least one listener is not registered.public static int watchKey(RegistryKey key, boolean watchSubtree, int dwNotifyFilter)
key
- the registry key to watch.watchSubtree
- whether or not changes in the subtree
should be reported.dwNotifyFilter
- filter of what changes to report.RegistryException
- if at least one listener is not registered.public static void removeKey(RegistryKey key)
key
from the list of watched
keys.key
- the registry key to stop monitoring.public static void removeID(int id)
id
- the id of the registry key to remove.Copyright © 2011, Yinon Michaeli. All rights reserved.