Java Code Examples for org.apache.commons.io.FilenameUtils.isExtension()

The following are Jave code examples for showing how to use isExtension() of the org.apache.commons.io.FilenameUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: butterfly   File: ExtensionRegistry.java   View Source Code Vote up 6 votes
/**
 * Copy all entries that are a JAR file or a directory
 */
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings (value="DMI_COLLECTION_OF_URLS", justification="All of type file")
private void copyValidClasspathEntries(Collection<URL> source, Set<URL> destination) {
    String fileName;
    boolean isJarFile;
    boolean isDirectory;

    for (URL url : source) {
        if(destination.contains(url)) {
            continue;
        }

        fileName = url.getFile();
        isJarFile = FilenameUtils.isExtension(fileName, "jar");
        isDirectory = new File(fileName).isDirectory();

        if (isJarFile || isDirectory) {
            destination.add(url);
        } else if (logger.isDebugEnabled()) {
            logger.debug("Ignored classpath entry: " + fileName);
        }
    }
}
 
Example 2
Project: living-documentation   File: AsciidocUtil.java   View Source Code Vote up 4 votes
public static boolean isAdoc(String filename) {
    return FilenameUtils.isExtension(filename, new String[]{Format.adoc.name(), Format.asciidoc.name()});
}
 
Example 3
Project: living-documentation   File: AbstractAsciidoctorMojo.java   View Source Code Vote up 4 votes
protected File getOutput(String filename, AbstractDocsGeneratorMojo.Format desiredExtension) {
    filename = FilenameUtils.isExtension(filename, desiredExtension.name()) ? filename : filename + "." + desiredExtension;
    return new File(generatedDocsDirectory, filename);
}
 
Example 4
Project: OneClient   File: ModInstaller.java   View Source Code Vote up 4 votes
public boolean isEnabled() {
	if (getHash() != null)
		return !FilenameUtils.isExtension(getHash().getFilePath(), "disabled");
	return false;
}