12.10.3. Implementation of Registry Access Functions as Native Methods
We need to implement three actions:
• Get the value of a name
• Set the value of a name
• Iterate through the names of a key
Fortunately, you have seen essentially all the tools that are required, such as the conversion between Java strings and arrays and those of C. You also saw how to raise a Java exception in case something goes wrong.
Two issues make these native methods more complex than the preceding examples. The
setValue methods deal with the type
Object, which can be one of
byte. The enumeration object stores the state between successive calls to
Let us first look at the
getValue method. The method ...