Package com.ms.lang |
![]() Previous |
![]() Microsoft Packages |
![]() Index |
![]() Next |
public class RegKey { // Fields public final static int KEYOPEN_READ = 1; public final static int KEYOPEN_WRITE = 2; public final static int KEYOPEN_ALL = 3; public final static int KEYOPEN_CREATE = 4; public final static int CLASSES_ROOT = 1; public final static int LOCALMACHINE_ROOT = 2; public final static int USER_ROOT = 3; public final static int USERS_ROOT = 4; // Constructor public RegKey(RegKey rkParent, String subKey, boolean createIfNess); // Methods public void finalize(); public void close(); public void deleteSubKey(String sub); public void deleteValue(String val); public RegKeyEnumValue enumValue(int idx); public String enumKey(int idx); public void flush(); public void loadKey(String subKey, String fileName); public String getStringValue(String name); public byte[] getBinaryValue(String name); public int getIntValue(String name); public void replace(String subKey, String newFile, String oldFile); public void restore( String filename, boolean vol ); public void setValue(String subKey, String val); public void setValue(String subKey, byte val[]); public void setValue(String subKey, int val); public void unload(String subKey); public RegQueryInfo queryInfo(); }
This class produces registry access objects.
public RegKey(RegKey rkParent, String subKey, boolean createIfNess)Creates the specified key. If the key already exists in the registry, the function opens it.
Return Value:
Returns the newly created registry key.
Parameter Description rk Identifies a currently open key or any of the following predefined reserved handle values:
null HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE HKEY_USERS The key created is a subkey of the key identified by the rk parameter. If the applet is running in a browser, or other protected environment, this parameter must be null. This specifies that the key will be created in a sandboxed section of the registry.
subKey Points to a String specifying the name of a subkey that this function opens or creates. The subkey specified must be a subkey of the key identified by the rk parameter. This subkey must not begin with the backslash character ('\'). This parameter cannot be null. create If this is true and the key does not exist, the key will be created Throws:
SecurityException If the parent key is not accessible.
IOExceptionIf the key can not be created.
See also Class RegKey.
public void finalize()Cleans up the registry key, closing it if open.
Return Value:
No return value.
public void close()Closes the key.
Return Value:
No return value.
Remarks:
Use close when the key is no longer needed. This ensures that the system registry keys are written to disk. After closing, the key must not be used again.
public void deleteSubKey(String sub)Removes a subkey from the key.
Return Value:
No return value.
Parameter Description sub The subkey to remove. Throws:
IOException if unsuccessful.
public void deleteValue(String val)Deletes a value from the key.
Return Value:
No return value.
Parameter Description val The name of the value to be deleted.
public RegKeyEnumValue enumValue(int idx)Enumerates subvalues of the key.
Return Value:
Returns the value of the provided index.
Parameter Description idx Index of the enumeration.
public String enumKey(int idx)Enumerates subkeys of the key.
Return Value:
Returns the name of the subkey.
Parameter Description idx Index of the enumeration.
public void flush()Flushes the key to the registry on disk.
Return Value:
No return value.
public void loadKey(String subKey, String fileName)Loads a new hive into the registry.
Parameter Description subKey Name of the subkey to be created to contain the new hive. fileName Name of a file containing the registry information.
public String getStringValue(String name)Retrieves a String value from the registry. The name is a sub key of the current key.
Return Value:
Returns a String value contained in the subKey.
Parameter Description name Name of the subKey containing the value wanted.
public byte[] getBinaryValue(String name)Retrieve a byte array from the registry. The name is a sub key of the current key.
Return Value:
Returns the byte array contained in the subKey.
Parameter Description name subKey containing the value wanted.
public int getIntValue(String name)Retrieve an integer value from the registry. The name is a sub key of the current key.
Return Value:
Returns the integer value contained in the subKey.
Parameter Description name subKey containing the value wanted.
public void replace(String subKey, String newFile, String oldFile)Replaces the file backing a key and all its subkeys with another file, so that when the system is next started, the key and subkeys will have the values stored in the new file.
Return Value:
No return value.
Parameter Description subKey Name of the sub key to replace. newFile Name of the file containing the new values. oldFile Name of the file to receive a backup copy of the old values.
public void restore( String filename, boolean vol )Restores a subkey from a file.
Return Value:
No return value.
Parameter Description file Name of the file containing the subkey. volatile True if the hive is to be volatile.
public void setValue(String subKey, String val)Sets a String value into a subkey.
Return Value:
No return value.
Parameter Description subKey The subkey to hold the value. val The string to write out.
public void setValue(String subKey, byte val[])Sets a byte array into a subkey.
Return Value:
No return value.
Parameter Description subKey The subkey to hold the value. val The array to write out.
public void setValue(String subKey, int val)Sets an integer value into a subkey.
Return Value:
No return value.
Parameter Description subKey The subkey to hold the value. val The int to write out.
public void unload(String subKey)Unloads a hive from the registry.
Return Value:
No return value.
Parameter Description subKey The subkey to unload.
public RegQueryInfo queryInfo()Retrieves information about the key.
Return Value:
Returns a RegQueryInfo object which contains the information.