Package ch.autumo.commons.utils.system
Class WinRegistry
java.lang.Object
ch.autumo.commons.utils.system.WinRegistry
Patched by autumo GmbH.
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
HEX Value for HKEY_CURRENT_USER.static final int
HEX Value for HKEY_LOCAL_MACHINE.static final int
Registry modification success return value. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Create a keystatic void
Delete a given keystatic void
deleteValue
(int hkey, String key, String value) delete a value from a given key/value namegetValue
(WinRegistry.RegistryHKey registryHKey, String key, String valueName) Get value.static String
readString
(int hkey, String key, String valueName) Read a value from key and value namereadStringSubKeys
(int hkey, String key) Read the value name(s) from a given keyreadStringValues
(int hkey, String key) Read value(s) and value name(s) form given keystatic void
writeStringValue
(int hkey, String key, String valueName, String value) Write a value in a given key/value name
-
Field Details
-
HKEY_CURRENT_USER
public static final int HKEY_CURRENT_USERHEX Value for HKEY_CURRENT_USER.- See Also:
-
HKEY_LOCAL_MACHINE
public static final int HKEY_LOCAL_MACHINEHEX Value for HKEY_LOCAL_MACHINE.- See Also:
-
REG_SUCCESS
public static final int REG_SUCCESSRegistry modification success return value.- See Also:
-
-
Constructor Details
-
WinRegistry
public WinRegistry()Windows Registry.
-
-
Method Details
-
readString
public static String readString(int hkey, String key, String valueName) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException Read a value from key and value name- Parameters:
hkey
- HKEY_CURRENT_USER/HKEY_LOCAL_MACHINEkey
- keyvalueName
- value name- Returns:
- value
- Throws:
IllegalArgumentException
- if illegal arguments are usedIllegalAccessException
- if access was illegalInvocationTargetException
- if invocation failed
-
readStringValues
public static Map<String,String> readStringValues(int hkey, String key) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException Read value(s) and value name(s) form given key- Parameters:
hkey
- HKEY_CURRENT_USER/HKEY_LOCAL_MACHINEkey
- key- Returns:
- the value name(s) plus the value(s)
- Throws:
IllegalArgumentException
- if illegal arguments are usedIllegalAccessException
- if access was illegalInvocationTargetException
- if invocation failed
-
readStringSubKeys
public static List<String> readStringSubKeys(int hkey, String key) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException Read the value name(s) from a given key- Parameters:
hkey
- HKEY_CURRENT_USER/HKEY_LOCAL_MACHINEkey
- key- Returns:
- the value name(s)
- Throws:
IllegalArgumentException
- if illegal arguments are usedIllegalAccessException
- if access was illegalInvocationTargetException
- if invocation failed
-
createKey
public static void createKey(int hkey, String key) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException Create a key- Parameters:
hkey
- HKEY_CURRENT_USER/HKEY_LOCAL_MACHINEkey
- key- Throws:
IllegalArgumentException
- if illegal arguments are usedIllegalAccessException
- if access was illegalInvocationTargetException
- if invocation failed
-
writeStringValue
public static void writeStringValue(int hkey, String key, String valueName, String value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException Write a value in a given key/value name- Parameters:
hkey
- HKEY_CURRENT_USER/HKEY_LOCAL_MACHINEkey
- keyvalueName
- value namevalue
- value- Throws:
IllegalArgumentException
- if illegal arguments are usedIllegalAccessException
- if access was illegalInvocationTargetException
- if invocation failed
-
deleteKey
public static void deleteKey(int hkey, String key) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException Delete a given key- Parameters:
hkey
- HKEY_CURRENT_USER/HKEY_LOCAL_MACHINEkey
- key- Throws:
IllegalArgumentException
- if illegal arguments are usedIllegalAccessException
- if access was illegalInvocationTargetException
- if invocation failed
-
deleteValue
public static void deleteValue(int hkey, String key, String value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException delete a value from a given key/value name- Parameters:
hkey
- HKEY_CURRENT_USER/HKEY_LOCAL_MACHINEkey
- keyvalue
- value- Throws:
IllegalArgumentException
- if illegal arguments are usedIllegalAccessException
- if access was illegalInvocationTargetException
- if invocation failed
-
getValue
public String getValue(WinRegistry.RegistryHKey registryHKey, String key, String valueName) throws UtilsException Get value.- Parameters:
registryHKey
- registry HKEYkey
- keyvalueName
- value name- Returns:
- value
- Throws:
UtilsException
- if invocation or access failed
-