|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectat.jta.Regor
public final class Regor
Title: Class is 100% pur Java Registry handle (just can write/read string values)
Description: You can read, delete or create any key in the registry (when you have access rights). But you just can read/delete and set string values! The java.dll doenst provide any other feature
Copyright: Copyright (c) 2006
Company: Taschek Joerg
| Field Summary | |
|---|---|
static int |
DELETE
Security Mask need by openKey - just for delete |
static int |
ERROR_ACCESS_DENIED
|
static int |
ERROR_CODE
|
static int |
ERROR_FILE_NOT_FOUND
|
static int |
ERROR_SUCCESS
|
static int |
HKEY_CLASSES_ROOT
the handle to the HKEY_CLASSES_ROOT registry root node |
static int |
HKEY_CURRENT_USER
the handle to the HEKY_CURRENT_USER registry root node |
static int |
HKEY_LOCAL_MACHINE
the handle to the HKEY_LOCAL_MACHINE registry root node |
static int |
KEY_ALL_ACCESS
Security Mask need by openKey - highest access to do everything (default access by openkey without security mask) |
static int |
KEY_CREATE_SUB_KEY
Security Mask need by openKey - for creating sub keys |
static int |
KEY_ENUMERATE_SUB_KEYS
Security Mask need by openKey - for enum sub keys |
static int |
KEY_QUERY_VALUE
Security Mask need by openKey - just for querying values |
static int |
KEY_READ
Security Mask need by openKey - for key reading |
static int |
KEY_SET_VALUE
Security Mask need by openKey - just for setting values |
static int |
KEY_WRITE
Security Mask need by openKey - for writing keys |
static int |
MAX_KEY_LENGTH
|
static int |
MAX_VALUE_NAME_LENGTH
|
static int |
NATIVE_HANDLE
|
static int |
SUBKEYS_NUMBER
|
static int |
VALUES_NUMBER
|
| Constructor Summary | |
|---|---|
Regor()
Constructor to handle with windows registry |
|
| Method Summary | |
|---|---|
int |
closeKey(int key)
Close an obtained key for right usage |
int |
createKey(int key,
java.lang.String subkey)
Create new key/subkey in the registry with the specified name Attentition: if the key is successfully returned, you should close and open the key again, because the obtained key doesnt have a high access level (so maybe creating or deleting a key/value wouldn´t be successful) |
int |
delKey(int key,
java.lang.String subkey)
deletes a key/subkey from the registry |
int |
delValue(int key,
java.lang.String valueName)
Method deletes the specified String value |
byte[] |
enumKeys(int key,
int subkeyIndex,
int maxKeyNameLength)
Reading the subkey name out of the registry (to obtain the count and the maxKeyNameLength use getChildInformation
method |
byte[] |
enumValueName(int key,
int valueNameIndex,
int maxValueNameLength)
Reading every valueName (not only the string value) out of the registry handle (for maximum value index and maxValueNameLength use the getChildInformation method |
int |
flushKey(int key)
Flush method - dont know what the method exactly does just implemented because i found it in the java sun source |
int[] |
getChildInformation(int key)
Reads information about the current opened key (use it when you want to enumKey or enumValueName to determine the maximum key length and the count of keys) |
java.util.List |
listKeys(int key)
Returns all subkeys from the given key |
java.util.List |
listKeys(int key,
java.lang.String subkey)
Returns all subkeys from the given key and subkey |
java.util.List |
listValueNames(int key)
Returns every valueName (not only the String value names) |
java.util.List |
listValueNames(int key,
java.lang.String subkey)
Returns every valueName (not only the String value names) |
static void |
main(java.lang.String[] args)
main for testing and some examples are stored here |
int |
openKey(int key,
java.lang.String subkey)
Opens a registry key |
int |
openKey(int key,
java.lang.String subkey,
int security_mask)
Opens a registry key |
static java.lang.String |
parseValue(byte[] buf)
Method removes the trailing \0 which is returned from the java.dll (just if the last sign is a \0) |
byte[] |
readValue(int key,
java.lang.String valueName)
Reads the value of an string value |
int |
setValue(int key,
java.lang.String valueName,
java.lang.String value)
Method set the specified string value Methode setzt (oder erstellt) einen Wert auf eine Zeichenfolge Will man den defaulteintrag ändern, so muss man valueName "" übergeben |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int HKEY_CLASSES_ROOT
public static final int HKEY_CURRENT_USER
public static final int HKEY_LOCAL_MACHINE
public static final int ERROR_SUCCESS
public static final int ERROR_FILE_NOT_FOUND
public static final int ERROR_ACCESS_DENIED
public static final int NATIVE_HANDLE
public static final int ERROR_CODE
public static final int SUBKEYS_NUMBER
public static final int VALUES_NUMBER
public static final int MAX_KEY_LENGTH
public static final int MAX_VALUE_NAME_LENGTH
public static final int DELETE
public static final int KEY_QUERY_VALUE
public static final int KEY_SET_VALUE
public static final int KEY_CREATE_SUB_KEY
public static final int KEY_ENUMERATE_SUB_KEYS
public static final int KEY_READ
public static final int KEY_WRITE
public static final int KEY_ALL_ACCESS
| Constructor Detail |
|---|
public Regor()
throws RegistryErrorException
RegistryErrorException - throws an registryerrorException when its not able to get a handle to the registry methods
NotSupportedOSException - throws an notSupportedOSException if the registry is not used in windows| Method Detail |
|---|
public byte[] enumValueName(int key,
int valueNameIndex,
int maxValueNameLength)
throws RegistryErrorException
key - the handle to the parent key obtained from openKeyvalueNameIndex - the index of the valueName name - starting from 0 going to the maximum count from the getChildInformation
stored in array index 2maxValueNameLength - maximum length of valueName name (used because for memory allocating in the java.dll - if you obtain
the size from getChildInformation increase the [4] int array by 1)
RegistryErrorException
public java.util.List listValueNames(int key,
java.lang.String subkey)
throws RegistryErrorException
key - either one of the root nodes or a key obtained from openKeysubkey - a string to a subkey - if the subkey is empty or null the information will be obtained from the given key
RegistryErrorException
public java.util.List listValueNames(int key)
throws RegistryErrorException
key - either one of the root nodes or a key obtained from openKey
RegistryErrorException
public byte[] enumKeys(int key,
int subkeyIndex,
int maxKeyNameLength)
throws RegistryErrorException
getChildInformation
method
key - the handle to the key obtained by openKeysubkeyIndex - index from the subkey from which you want to obtain the name (start with 0 - the maximum count you get from
getChildInformation method in array [0])maxKeyNameLength - the maximum length of a subkey name (used because for memory allocating in the java.dll - if you obtain
the size from getChildInformation increase the [3] int array by 1 )
RegistryErrorException
public java.util.List listKeys(int key,
java.lang.String subkey)
throws RegistryErrorException
key - either one of the root nodes or a key obtained from openKeysubkey - a string to a subkey - if the subkey is empty or null the information will be obtained from the given key
RegistryErrorException
public java.util.List listKeys(int key)
throws RegistryErrorException
key - either one of the root nodes or a key obtained from openKey
RegistryErrorException
public int[] getChildInformation(int key)
throws RegistryErrorException
key - the key which you obtained from openKey
RegistryErrorException
public int delValue(int key,
java.lang.String valueName)
throws RegistryErrorException
key - the key obtained by openKeyvalueName - name of String value you want to delete (if the string is empty or null the default entry will be
deleted)
RegistryErrorException
public int setValue(int key,
java.lang.String valueName,
java.lang.String value)
throws RegistryErrorException
key - obtained by openKeyvalueName - the string value name in the registry you want to setvalue - the new value you want to set
RegistryErrorException
public byte[] readValue(int key,
java.lang.String valueName)
throws RegistryErrorException
key - obtained from openKeyvalueName - the string value which you want to read (if you want to obtain the default entry the valueName should be
empty or NULL)
RegistryErrorException
public int flushKey(int key)
throws RegistryErrorException
key - obtained the key from openKey
RegistryErrorException
public int delKey(int key,
java.lang.String subkey)
throws RegistryErrorException
key - the parent key obtained by openKeysubkey - the key name you want to delete
RegistryErrorException - if subkey is empty or null or any other exception occurs
public int createKey(int key,
java.lang.String subkey)
throws RegistryErrorException
key - handle to parent key obtained from openKeysubkey - name of the key/subkey you want to create
RegistryErrorException
public int closeKey(int key)
throws RegistryErrorException
key - the key handle
RegistryErrorException
public int openKey(int key,
java.lang.String subkey,
int security_mask)
throws RegistryErrorException
key - one of the registry root nodes - either HKEY_CLASSES_ROOT, HKEY_CURRENT_USER or HKEY_LOCAL_MACHINEsubkey - the name of the key/subkey like SOFTWARE or HARDWARE - for subkeys use the \\ as delimiter f.e. : SOFTWARE\\MICROSOFT
if subkey name is "" or null it returns the handle to the root nodesecurity_mask - the security mask to handle with the opened key (see security mask doc at the begin for detailed information)
RegistryErrorException
public int openKey(int key,
java.lang.String subkey)
throws RegistryErrorException
key - one of the registry root nodes - either HKEY_CLASSES_ROOT, HKEY_CURRENT_USER or HKEY_LOCAL_MACHINEsubkey - the name of the key/subkey like SOFTWARE or HARDWARE - for subkeys use the \\ as delimiter f.e. : SOFTWARE\\MICROSOFT
if subkey name is "" or null it returns the handle to the root node
RegistryErrorExceptionpublic static java.lang.String parseValue(byte[] buf)
buf - the byte[] buffer which every read method returns
public static void main(java.lang.String[] args)
throws java.lang.Exception
args - String[]
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||