Package at.letto.tools
Class WinRegistry
java.lang.Object
at.letto.tools.WinRegistry
Zugriff auf die Windows Registry
- Author:
- http://stackoverflow.com/questions/62289/read-write-to-windows-registry-using-java
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
private static final int
private static final int
static final int
static final int
static final int
private static Method
private static Method
private static Method
private static Method
private static Method
private static Method
private static Method
private static Method
private static Method
private static Method
private static Preferences
private static Class
<? extends Preferences> private static Preferences
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Create a keyprivate static int[]
createKey
(Preferences root, int hkey, String key) static void
Delete a given keyprivate static int
deleteKey
(Preferences root, int hkey, String key) static void
deleteValue
(int hkey, String key, String value) delete a value from a given key/value nameprivate static int
deleteValue
(Preferences root, int hkey, String key, String value) static String
readString
(int hkey, String key, String valueName) Read a value from key and value nameprivate static String
readString
(Preferences root, int hkey, String key, String value) readStringSubKeys
(int hkey, String key) Read the value name(s) from a given keyreadStringSubKeys
(Preferences root, int hkey, String key) readStringValues
(int hkey, String key) Read value(s) and value name(s) form given keyreadStringValues
(Preferences root, int hkey, String key) private static byte[]
static void
writeStringValue
(int hkey, String key, String valueName, String value) Write a value in a given key/value nameprivate static void
writeStringValue
(Preferences root, int hkey, String key, String valueName, String value)
-
Field Details
-
HKEY_CURRENT_USER
public static final int HKEY_CURRENT_USER- See Also:
-
HKEY_LOCAL_MACHINE
public static final int HKEY_LOCAL_MACHINE- See Also:
-
REG_SUCCESS
public static final int REG_SUCCESS- See Also:
-
REG_NOTFOUND
public static final int REG_NOTFOUND- See Also:
-
REG_ACCESSDENIED
public static final int REG_ACCESSDENIED- See Also:
-
KEY_ALL_ACCESS
private static final int KEY_ALL_ACCESS- See Also:
-
KEY_READ
private static final int KEY_READ- See Also:
-
userRoot
-
systemRoot
-
userClass
-
regOpenKey
-
regCloseKey
-
regQueryValueEx
-
regEnumValue
-
regQueryInfoKey
-
regEnumKeyEx
-
regCreateKeyEx
-
regSetValueEx
-
regDeleteKey
-
regDeleteValue
-
-
Constructor Details
-
WinRegistry
private WinRegistry()
-
-
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
- Name- Returns:
- the value
- Throws:
IllegalArgumentException
- FehlerIllegalAccessException
- FehlerInvocationTargetException
- Fehler
-
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
- FehlerIllegalAccessException
- FehlerInvocationTargetException
- Fehler
-
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
- FehlerIllegalAccessException
- FehlerInvocationTargetException
- Fehler
-
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
- FehlerIllegalAccessException
- FehlerInvocationTargetException
- Fehler
-
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
- hkeykey
- keyvalueName
- Namevalue
- Value- Throws:
IllegalArgumentException
- FehlerIllegalAccessException
- FehlerInvocationTargetException
- Fehler
-
deleteKey
public static void deleteKey(int hkey, String key) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException Delete a given key- Parameters:
hkey
- hkeykey
- key- Throws:
IllegalArgumentException
- FehlerIllegalAccessException
- FehlerInvocationTargetException
- Fehler
-
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
- hkeykey
- keyvalue
- Value- Throws:
IllegalArgumentException
- FehlerIllegalAccessException
- FehlerInvocationTargetException
- Fehler
-
deleteValue
private static int deleteValue(Preferences root, int hkey, String key, String value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException -
deleteKey
private static int deleteKey(Preferences root, int hkey, String key) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException -
readString
private static String readString(Preferences root, int hkey, String key, String value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException -
readStringValues
private static Map<String,String> readStringValues(Preferences root, int hkey, String key) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException -
readStringSubKeys
private static List<String> readStringSubKeys(Preferences root, int hkey, String key) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException -
createKey
private static int[] createKey(Preferences root, int hkey, String key) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException -
writeStringValue
private static void writeStringValue(Preferences root, int hkey, String key, String valueName, String value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException -
toCstr
-