Class RegistryKey.Handle

  • All Implemented Interfaces:
    AutoCloseable
    Enclosing class:
    RegistryKey

    public abstract class RegistryKey.Handle
    extends Object
    implements AutoCloseable
    A handle to a registry key. This offers mostly the same functionality as RegistryKey itself. However, it reuses the same link to the Windows registry instead of creating a new one every time. That makes it more efficient if multiple operations on the same registry key are needed. Handle instances should be closed when they are no longer needed to release the link to the Windows registry.

    Note that the way the handle is created may limit the available operations. For instance, if RegistryKey.HandleOption.MANAGE_VALUES isn't given, trying to set or delete registry values will lead to RegistryAccessDeniedExceptions.

    Author:
    Rob Spoor