@Override
    public boolean isFileExtensionRegistered(String fileTypeExtension) throws RegistryException, OSException {
        if (!isApplicable()) {
            return false;
        }

        // sanitize file extension
        fileTypeExtension = sanitizeFileExtension(fileTypeExtension);

        String[] hives = {Hive.HKEY_CURRENT_USER + SOFTWARE_CLASSES_PATH, Hive.HKEY_LOCAL_MACHINE + SOFTWARE_CLASSES_PATH, Hive.HKEY_CLASSES_ROOT + "\\"};

        for (String h : hives) {
            List<String> subkeys = WindowsRegistry.readSubkeys(h);
            if (subkeys.contains(fileTypeExtension)) {
                return true;
            }
        }
        return false;
    }
@ Override public boolean isFileExtensionRegistered ( String fileTypeExtension ) throws RegistryException , OSException { if ( ! isApplicable ( ) ) { return false ; } fileTypeExtension = sanitizeFileExtension ( fileTypeExtension ) ; String [ ] hives = { Hive . HKEY_CURRENT_USER + SOFTWARE_CLASSES_PATH , Hive . HKEY_LOCAL_MACHINE + SOFTWARE_CLASSES_PATH , Hive . HKEY_CLASSES_ROOT + "\\" } ; for ( String h : hives ) { List < String > subkeys = WindowsRegistry . readSubkeys ( h ) ; if ( subkeys . contains ( fileTypeExtension ) ) { return true ; } } return false ; }
Checks if the given extension is already registered.

@param fileTypeExtension File extension with leading dot, e.g.
<code>.bar</code>.
@return <code>true</code> if extension is registered, <code>false</code>
otherwise.
@throws RegistryException