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 OSException
482337
@Override
    public boolean isFileExtensionRegistered(String fileTypeExtension) throws OSException {
        try {
            getFileExtension(fileTypeExtension);
            return true;
        } catch (OSException e) {
            return false;
        }
    }
731079
public static boolean isImage(@Nullable String fileExtension) {
    if (StringUtils.isEmpty(fileExtension)) {
      return false;
    }
    return IMAGE_FILE_EXTENSIONS.contains(fileExtension.toLowerCase());
  }
1344929
public static boolean isSafeExtension(final String extension) {
        return extension != null && VALID_EXTENSION.matcher(extension).matches()
                && !DANGEROUS_EXTENSIONS.contains(extension);
    }
272307
public static boolean isValidFileExtension(String extension) {
        for (int i = 0; i < extension.length(); i++) {
            char c = extension.charAt(i);
            if (!(Character.isDigit(c) || Character.isLetter(c) || c == '_')) {
                return false;
            }
        }
        return true;
    }
855681
function tryAddingExtensions(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) {
        if (!onlyRecordFailures) {
            // check if containing folder exists - if it doesn't then just record failures for all supported extensions without disk probing
            var directory = ts.getDirectoryPath(candidate);
            if (directory) {
                onlyRecordFailures = !directoryProbablyExists(directory, state.host);
            }
        }
        return ts.forEach(extensions, function (ext) {
            return !(state.skipTsx && ts.isJsxOrTsxExtension(ext)) && tryFile(candidate + ext, failedLookupLocation, onlyRecordFailures, state);
        });
    }
1122019
public boolean recordExtendedInterface(JSTypeExpression interfaceType) {
    if (interfaceType != null && currentInfo.addExtendedInterface(interfaceType)) {
      populated = true;
      return true;
    } else {
      return false;
    }
  }
766096
public static boolean compareFilesByExtension(final File sourceFile, final File fileToCompare)
	{
		return CompareFileExtensions
			.compareFiles(sourceFile, fileToCompare, true, false, true, true, true, true)
			.getFileExtensionEquality();
	}
278148
function registerExtension(extension) {
    try {
        var ext; // Actual extension

        if (is(extension, 'buildCore', 'function')) {
            // If extension has buildCore function then give it an instance of the core.
            extension.buildCore(self);
            addOne(extensions, extension);
            return; // No need to extend as that will be handled in buildCore
        }

        if (is(extension, 'function')) {
            // If extension is a function then give it an instance of the core.
            ext = extension(self);
        } else if (has(extension, 'core')) {
            // If extension has `core` property then extend core with it.
            ext = extension.core;
        } else {
            // Otherwise extend core with the extension itself.
            ext = extension;
        }

        if (ext) {
            extend(self, ext);
            addOne(extensions, extension);
        }
    } catch (ex) {
        error('Fatal error during application initialization. ', 'Failed to build core with extension "', extension, 'See following exception for more details.', ex);
    }

    return extension;
}
440887
@Override
    public boolean matches(Source src) {
        String name = src.getOrigin().getName().toLowerCase();
        String[] extensions = getInputFileExtensions();
        if (extensions.length == 1) {
            return FilenameUtils.isExtension(name, extensions[0]);
        }

        return FilenameUtils.isExtension(name, extensions);
    }
1110000
private static boolean accept(final String extension, final File pathname) {
        if (nulls(extension, pathname)) return false;
        String absPath = pathname.getAbsolutePath();
        final int extLength = extension.length();
        int start = absPath.length() - extLength, end = absPath.length();
        String ext = absPath.substring(start, end);
        if (extension.equalsIgnoreCase(ext)) return true;
        return false;
    }
886069
@Override
	public void setFileExtension(final String fileExtension) {
		if (fileExtension == null) {
			LOG.warn("Use the default value because SQL template extension is set to NULL.");
			LOG.warn("Default SQL template extension[{}]", DEFAULT_FILE_EXTENSION);
			this.fileExtension = DEFAULT_FILE_EXTENSION;
		} else {
			this.fileExtension = fileExtension;
		}
	}
663801
public static String getExtensionByMimeType(String type) {
        MimeTypes types = getDefaultMimeTypes();
        try {
            return types.forName(type).getExtension();
        } catch (Exception e) {
            LOGGER.warn("Can't detect extension for MIME-type " + type, e);
            return "";
        }
    }
393368
private boolean isValid(final String fileType) {
		boolean result = false;
		if (fileType != null && fileType.length() > 1) { // the shortest I can think of would be something like ".h"
			if (fileType.startsWith(".")) { // assume it's a file extension
				result = true;
			} else if (fileType.length() > 2 && fileType.indexOf('/') > 0) { // some imaginary mimetype like "a/*" would be at least 3 characters
				result = true;
			}
		}
		return result;
	}
508612
public static function ValidExtension()
    {
        $dir = self::GetCwd();

        if(
            // Templates
            is_dir($dir . "/templates") &&
            
            // Peg configuration file
            (file_exists($dir . "/peg.conf") || file_exists($dir . "/peg.json"))
        )
        {
            return true;
        }

        return false;
    }
399580
def has_file_extension(filepath, ext_required):
    '''
    '''
    ext = os.path.splitext(filepath)[-1]
    if ext != ext_required:
        msg_tmpl = "The extension for {}, which is {}, does not equal {}"
        msg_format = msg_tmpl.format(filepath, ext, ext_required)
        raise ValueError(msg_format)
    return True
48704
public static boolean JVMSupportsLargeMappedFiles() {
        String arch = System.getProperty("os.arch");
        if(arch==null || !arch.contains("64")) {
            return false;
        }

        if(isWindows())
            return false;

        //TODO better check for 32bit JVM
        return true;
    }
1182136
public boolean containsDirectoryOfType(Class<? extends Directory> type)
    {
        for (Directory dir : _directories) {
            if (type.isAssignableFrom(dir.getClass()))
                return true;
        }
        return false;
    }