| 
 | Classic JavaDoc | 
Class Registry
java.lang.Object └ com.moyosoft.connector.registry.Registry
public final class Registry
 Example source code:
 
 // Load the native library:
 System.loadLibrary("moyocore");
 
 // Get the location of the Program Files folder from the registy:
 String programFilesPath = Registry.getLocalMachineKey().getValue(
     "SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
     "ProgramFilesDir").getString();
 
 System.out.println("ProgramFilesDir = " + programFilesPath);
 System.out.println();
 
 // Create a new key:
 RegistryKey registryKey = Registry.getLocalMachineKey().createKey("SOFTWARE\\TestMoyosoft");
 
 try
 {
     // Add some values:
     registryKey.setValue("Test value", 		"This is a test value");
     registryKey.setValue("Numeric value", 	123);
     registryKey.setValue("Binary value", 	new byte[] {0x01, 0x02, 0x03});
 
     // Set the key's Default value:
     registryKey.setValue("", 				new RegistryValue(456));
 
     // Iterate through all values in this registry key:
     for(Iterator it = registryKey.getValues(); it.hasNext(); )
     {
         String valueName = (String) it.next();
         System.out.println("Value name: " + valueName);
         System.out.println("Value: " + registryKey.getValue(valueName));
         System.out.println();
     }
     // Iterate through all sub-keys in this registry key:
     for(Iterator it = registryKey.getSubKeys(); it.hasNext(); )
     {
         System.out.println("Key name: " + (String) it.next());
     }
     // Delete the previously created values:
     registryKey.deleteValue("Test value");
     registryKey.deleteValue("Numeric value");
     registryKey.deleteValue("Binary value");
     registryKey.deleteValue("");
 }
 finally
 {
     // Close the registry key:
     registryKey.close();
 }
 
Methods
| static RegistryKey | getCurrentConfigKey () | |
| Returns the registry key HKEY_CURRENT_CONFIG. | 
| static RegistryKey | getCurrentUserKey () | |
| Returns the registry key HKEY_CURRENT_USER. | 
| static RegistryKey | getLocalMachineKey () | |
| Returns the registry key HKEY_LOCAL_MACHINE. | 
| static RegistryKey | getUsersKey () | |
| Returns the registry key HKEY_USERS. | 
| static RegistryKey | openCurrentConfigKey (String subKey) | |
| Opens the specified sub-key of the registry key HKEY_CURRENT_CONFIG. If this method returns  successfully, the returned RegistryKey object has to be closed using the  method RegistryKey.close(). | 
| static RegistryKey | openCurrentUserKey (String subKey) | |
| Opens the specified sub-key of the registry key HKEY_CURRENT_USER. If this method returns  successfully, the returned RegistryKey object has to be closed using the  method RegistryKey.close(). | 
| static RegistryKey | openLocalMachineKey (String subKey) | |
| Opens the specified sub-key of the registry key HKEY_LOCAL_MACHINE. If this method returns  successfully, the returned RegistryKey object has to be closed using the  method RegistryKey.close(). | 
| static RegistryKey | openUsersKey (String subKey) | |
| Opens the specified sub-key of the registry key HKEY_USERS. If this method returns  successfully, the returned RegistryKey object has to be closed using the  method RegistryKey.close(). | 
Community comments
Powered by JavaDocPlus
