| java.lang.Object com.ice.jni.registry.RegistryKey
RegistryKey | public class RegistryKey (Code) | | The RegistryKey class represents a key in the registry.
The class also provides all of the native interface calls.
You should refer to the Windows Registry API documentation
for the details of any of the native methods. The native
implementation performs almost no processing before or after
a given call, so their behavior should match the API's
documented behavior precisely.
Note that you can not open a subkey without an existing
open RegistryKey. Thus, you need to start with one of the
top level keys defined in the Registry class and open
relative to that.
See Also: com.ice.jni.registry.Registry See Also: com.ice.jni.registry.RegistryValue |
Inner Class :class RegistryKeyEnumerator implements Enumeration | |
Inner Class :class RegistryValueEnumerator implements Enumeration | |
Field Summary | |
final public static int | ACCESS_ALL | final public static int | ACCESS_DEFAULT Constants used to determine the access level for
newly opened keys. | final public static int | ACCESS_EXECUTE | final public static int | ACCESS_READ | final public static int | ACCESS_WRITE | protected boolean | created Used to indicate whether or not the key was created
when method createSubKey() is called, otherwise false. | protected int | hKey This is the actual DWORD key that is returned from the
Registry API. | protected String | name The full pathname of this key. |
Method Summary | |
native public void | closeKey() Closes this subkey. | native public RegistryKey | connectRegistry(String hostName) Connect to the remote registry on hostName.
This method will only work when invoked on a toplevel
key. | public RegistryKey | createSubKey(String subkey, String className) Create, and open, a Registry subkey of this key with WRITE access.
If the key already exists, it is opened, otherwise it is first
created and then opened.
Parameters: subkey - The name of the subkey to create. Parameters: className - The className of the created subkey. | native public RegistryKey | createSubKey(String subKey, String className, int access) Create a new subkey, or open the existing one. | native public int | decrDoubleWord(String valueName) This method will decrement the value of a REG_DWORD value. | native public void | deleteSubKey(String subKey) Delete a named subkey. | native public void | deleteValue(String valueName) Delete a named value. | native public static String | expandEnvStrings(String exString) This method will expand a string to include the definitions
of System environment variables that are referenced via the
%variable% construct. | public void | export(PrintWriter out, boolean descend) Export this key's definition to the provided PrintWriter. | public void | finalize() The finalize() override checks to be sure the key is closed. | native public void | flushKey() Guarentees that this key is written to disk. | native public String | getDefaultValue() Get the data from the default value. | public String | getFullName() Get the full name of the key, from the top level down. | native public int | getMaxSubkeyLength() Obtains the maximum length of all of the subkey names. | native public int | getMaxValueDataLength() Obtains the maximum length of all of the value data. | native public int | getMaxValueNameLength() Obtains the maximum length of all of the value names. | public String | getName() Get the name of this key. | native public int | getNumberSubkeys() Obtains the number of subkeys that this key contains. | native public int | getNumberValues() Obtains the number of values that this key contains. | native public String | getStringValue(String valueName) Get the value of a REG_SZ or REG_EXPAND_SZ value.
Parameters: valueName - The name of the value to get. | native public RegistryValue | getValue(String valueName) Get the data of a named value.
Parameters: valueName - The name of the value to get. | native public boolean | hasDefaultValue() Determines if this key has a default value. | native public boolean | hasOnlyDefaultValue() Determines if this key has only a default value. | native public int | incrDoubleWord(String valueName) This method will increment the value of a REG_DWORD value. | public Enumeration | keyElements() | public RegistryKey | openSubKey(String subkey) Open a Registry subkey of this key with READ access.
Parameters: subkey - The name of the subkey to open. | native public RegistryKey | openSubKey(String subKey, int access) Open a Registry subkey of this key with the specified access.
Parameters: subkey - The name of the subkey to open. Parameters: access - The access level for the open. | native public String | regEnumKey(int index) Obtains an enumerator for the subkeys of this key. | native public String | regEnumValue(int index) Obtains an enumerator for the values of this key. | public void | setCreated(boolean created) Used to set the created state of this key. | public void | setValue(RegistryValue value) Set the value of this RegistryKey. | native public void | setValue(String valueName, RegistryValue value) Set the name value to the given data. | public Enumeration | valueElements() | public boolean | wasCreated() Determine if this key was opened or created and opened. |
ACCESS_ALL | final public static int ACCESS_ALL(Code) | | |
ACCESS_DEFAULT | final public static int ACCESS_DEFAULT(Code) | | Constants used to determine the access level for
newly opened keys.
|
ACCESS_EXECUTE | final public static int ACCESS_EXECUTE(Code) | | |
ACCESS_READ | final public static int ACCESS_READ(Code) | | |
ACCESS_WRITE | final public static int ACCESS_WRITE(Code) | | |
created | protected boolean created(Code) | | Used to indicate whether or not the key was created
when method createSubKey() is called, otherwise false.
|
hKey | protected int hKey(Code) | | This is the actual DWORD key that is returned from the
Registry API. This value is totally opaque
and should never be referenced.
|
name | protected String name(Code) | | The full pathname of this key.
|
RegistryKey | public RegistryKey(int hKey, String name, boolean created)(Code) | | |
closeKey | native public void closeKey() throws RegistryException(Code) | | Closes this subkey. You may chose to let the finalize()
method do the close.
exception: RegistryException - Any valid registry API error. |
connectRegistry | native public RegistryKey connectRegistry(String hostName) throws NoSuchKeyException, RegistryException(Code) | | Connect to the remote registry on hostName.
This method will only work when invoked on a toplevel
key. The returned value will be the same toplevel key
opened from the remote host's registry.
Parameters: hostName - The remote computer's hostname. The remote top level key identical to this top level key. exception: NoSuchKeyException - If the subkey does not exist. exception: RegistryException - Any other registry API error. |
createSubKey | public RegistryKey createSubKey(String subkey, String className) throws RegistryException(Code) | | Create, and open, a Registry subkey of this key with WRITE access.
If the key already exists, it is opened, otherwise it is first
created and then opened.
Parameters: subkey - The name of the subkey to create. Parameters: className - The className of the created subkey. The newly created and opened RegistryKey. exception: RegistryException - Any valid registry API error. |
createSubKey | native public RegistryKey createSubKey(String subKey, String className, int access) throws RegistryException(Code) | | Create a new subkey, or open the existing one. You can
determine if the subkey was created, or whether an
existing subkey was opened, via the wasCreated() method.
Parameters: subKey - The name of the subkey to create/open. Parameters: className - The key's class name, or null. Parameters: access - The access level of the opened subkey. The newly created or opened subkey. exception: RegistryException - Any valid registry API error. |
expandEnvStrings | native public static String expandEnvStrings(String exString)(Code) | | This method will expand a string to include the definitions
of System environment variables that are referenced via the
%variable% construct. This method invokes EnvExpandStrings().
Parameters: valueName - The name of the value to increment. |
finalize | public void finalize()(Code) | | The finalize() override checks to be sure the key is closed.
|
flushKey | native public void flushKey() throws RegistryException(Code) | | Guarentees that this key is written to disk. This
method should be called only when needed, as it has
a huge performance cost.
exception: RegistryException - Any valid registry API error. |
getFullName | public String getFullName()(Code) | | Get the full name of the key, from the top level down.
The full name of the key. |
getMaxSubkeyLength | native public int getMaxSubkeyLength() throws RegistryException(Code) | | Obtains the maximum length of all of the subkey names.
The maximum length of all of the subkey names. exception: RegistryException - Any valid registry API error. |
getMaxValueDataLength | native public int getMaxValueDataLength() throws RegistryException(Code) | | Obtains the maximum length of all of the value data.
The maximum length of all of the value data. exception: RegistryException - Any valid registry API error. |
getMaxValueNameLength | native public int getMaxValueNameLength() throws RegistryException(Code) | | Obtains the maximum length of all of the value names.
The maximum length of all of the value names. exception: RegistryException - Any valid registry API error. |
getName | public String getName()(Code) | | Get the name of this key. This is not fully
qualified, which means that the name will not contain
any backslashes.
The relative name of this key. |
getNumberSubkeys | native public int getNumberSubkeys() throws RegistryException(Code) | | Obtains the number of subkeys that this key contains.
The number of subkeys that this key contains. exception: RegistryException - Any valid registry API error. |
getNumberValues | native public int getNumberValues() throws RegistryException(Code) | | Obtains the number of values that this key contains.
The number of values that this key contains. exception: RegistryException - Any valid registry API error. |
hasDefaultValue | native public boolean hasDefaultValue() throws RegistryException(Code) | | Determines if this key has a default value.
True if there is a default value, else false. exception: RegistryException - Any valid registry API error. |
hasOnlyDefaultValue | native public boolean hasOnlyDefaultValue() throws RegistryException(Code) | | Determines if this key has only a default value.
True if there is only a default value, else false. exception: RegistryException - Any valid registry API error. |
keyElements | public Enumeration keyElements() throws RegistryException(Code) | | Returns a new Enumeration that will enumerate the
names of the subkeys of this key,
A new Enumeration to enumerate subkey names. exception: RegistryException - Any valid registry API error. |
setCreated | public void setCreated(boolean created)(Code) | | Used to set the created state of this key.
Parameters: created - The new created state. |
setValue | native public void setValue(String valueName, RegistryValue value) throws RegistryException(Code) | | Set the name value to the given data.
Parameters: valueName - The name of the value to set. Parameters: value - The data to set the named value. exception: RegistryException - Any valid registry API error. |
valueElements | public Enumeration valueElements() throws RegistryException(Code) | | Returns a new Enumeration that will enumerate the
names of the values of this key,
A new Enumeration to enumerate value names. exception: RegistryException - Any valid registry API error. |
wasCreated | public boolean wasCreated()(Code) | | Determine if this key was opened or created and opened.
The result can only be true if createSubKey() was called
and the key did not exist, and the creation of the new
subkey succeeded.
True if the key was created new, else false. |
|
|