
com.github.sarxos.winreg.HKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of windows-registry-util Show documentation
Show all versions of windows-registry-util Show documentation
100% pure Java, simple Windows registry utility
package com.github.sarxos.winreg;
import java.util.prefs.Preferences;
/**
* HKEY
*
* @author Bartosz Firyn (SarXos)
*/
public enum HKey {
/**
* HKEY_CURRENT_USER
*/
HKCU(0x80000001, Preferences.userRoot()),
/**
* HKEY_LOCAL_MACHINE
*/
HKLM(0x80000002, Preferences.systemRoot());
private int hex = 0;
private Preferences root = null;
private HKey(final int hex, final Preferences root) {
this.hex = hex;
this.root = root;
}
public int hex() {
return hex;
}
public Preferences root() {
return root;
}
public static HKey fromHex(int hex) {
HKey[] hks = HKey.values();
for (HKey hk : hks) {
if (hk.hex() == hex) {
return hk;
}
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy