Example usage for org.apache.commons.imaging Imaging hasImageFileExtension

List of usage examples for org.apache.commons.imaging Imaging hasImageFileExtension

Introduction

In this page you can find the example usage for org.apache.commons.imaging Imaging hasImageFileExtension.

Prototype

public static boolean hasImageFileExtension(String filename) 

Source Link

Document

Attempts to determine if a file contains an image recorded in a supported graphics format based on its file-name extension (for example ".jpg", ".gif", ".png", etc.).

Usage

From source file:lucee.runtime.img.coder.SanselanCoder.java

protected SanselanCoder() {
    super();
    Imaging.hasImageFileExtension("lucee.gif");// to make sure Sanselan exist when load this class
}

From source file:net.tourbook.photo.ImageUtils.java

public static FileFilter createImageFileFilter() {

    return new FileFilter() {
        @Override/*from w  w  w. j  a va 2s.  c o  m*/
        public boolean accept(final File pathname) {

            if (pathname.isDirectory()) {
                return false;
            }

            if (pathname.isHidden()) {
                return false;
            }

            final String name = pathname.getName();
            if (name == null || name.length() == 0) {
                return false;
            }

            if (name.startsWith(".")) { //$NON-NLS-1$
                return false;
            }

            if (Imaging.hasImageFileExtension(pathname)) {
                return true;
            }

            return false;
        }
    };
}