java.lang.Objectcom.install4j.api.windows.WinRegistry
public class WinRegistry
Collection of static methods to access the Microsoft Windows registry.
Nested Class Summary | |
---|---|
static class |
WinRegistry.ExpandString
Class to represent Strings with type REG_EXPAND_SZ. |
Method Summary | |
---|---|
static boolean |
createKey(RegistryRoot root,
java.lang.String keyName)
Creates a registry key. |
static void |
deleteKey(RegistryRoot root,
java.lang.String keyName,
boolean onlyIfEmpty)
Deletes a registry key. |
static void |
deleteValue(RegistryRoot root,
java.lang.String keyName,
java.lang.String valueName)
Deletes a registry value. |
static java.lang.String[] |
getSubKeyNames(RegistryRoot root,
java.lang.String keyName)
Retrieves the sub keys of a registry key. |
static java.lang.Object |
getValue(RegistryRoot root,
java.lang.String keyName,
java.lang.String valueName)
Retrieves a registry value. |
static boolean |
keyExists(RegistryRoot root,
java.lang.String keyName)
Checks if a registry key exists. |
static boolean |
restoreKey(RegistryRoot root,
java.lang.String keyName,
java.lang.String fileName)
Restore a sub-tree of the registry from a file. |
static boolean |
saveKey(RegistryRoot root,
java.lang.String keyName,
java.lang.String fileName)
Save a sub-tree of the registry to a file. |
static boolean |
setValue(RegistryRoot root,
java.lang.String keyName,
java.lang.String valueName,
java.lang.Object value)
Sets a registry value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean keyExists(RegistryRoot root, java.lang.String keyName)
root
- one of the RegistryRoot.* constants.keyName
- the name of the key without a leading backslash.
public static boolean createKey(RegistryRoot root, java.lang.String keyName)
root
- one of the RegistryRoot.* constants.keyName
- the name of the key without a leading backslash.
public static java.lang.Object getValue(RegistryRoot root, java.lang.String keyName, java.lang.String valueName)
root
- one of the RegistryRoot.* constants.keyName
- the name of the key without a leading backslash.valueName
- the name of the registry value.
public static boolean setValue(RegistryRoot root, java.lang.String keyName, java.lang.String valueName, java.lang.Object value)
root
- one of the RegistryRoot.* constantskeyName
- the name of the key without a leading backslash.valueName
- the name of the registry value.value
- an instance of one of the following classes: String, Integer,
String[], byte[], WinRegistry.ExpandString.
public static void deleteValue(RegistryRoot root, java.lang.String keyName, java.lang.String valueName)
root
- one of the RegistryRoot.* constants.keyName
- the name of the key without a leading backslash.valueName
- the name of the registry value.public static void deleteKey(RegistryRoot root, java.lang.String keyName, boolean onlyIfEmpty)
root
- one of the RegistryRoot.* constants.keyName
- the name of the key without a leading backslash.onlyIfEmpty
- if true, the method will delete the key only if the key contains no
values and no subkey.public static java.lang.String[] getSubKeyNames(RegistryRoot root, java.lang.String keyName)
root
- one of the RegistryRoot.* constants.keyName
- the name of the key without a leading backslash.
public static boolean saveKey(RegistryRoot root, java.lang.String keyName, java.lang.String fileName)
root
- one of the RegistryRoot.* constants.keyName
- the name of the key without a leading backslash. This is the root of the saved sub-tree.fileName
- the file to which the sub-tree should be saved.
restoreKey(RegistryRoot, String, String)
public static boolean restoreKey(RegistryRoot root, java.lang.String keyName, java.lang.String fileName)
root
- one of the RegistryRoot.* constants.keyName
- the name of the key without a leading backslash. This is the key to which the root of the saved sub-tree
will be restored.fileName
- the file from which the saved sub-tree should be read.
saveKey(RegistryRoot, String, String)