Example usage for org.apache.commons.imaging ImageFormat getAllFormats

List of usage examples for org.apache.commons.imaging ImageFormat getAllFormats

Introduction

In this page you can find the example usage for org.apache.commons.imaging ImageFormat getAllFormats.

Prototype

public static ImageFormat[] getAllFormats() 

Source Link

Document

Gets an array of ImageFormat objects for all supported image formats.

Usage

From source file:com.vividsolutions.jump.workbench.imagery.graphic.CommonsImageFactory.java

public boolean isAvailable(WorkbenchContext context) {
    Class c = null;//from   w w  w  .  ja v  a2  s .co  m
    try {
        c = this.getClass().getClassLoader().loadClass("org.apache.commons.imaging.Imaging");
        if (c == null)
            return false;

        for (ImageFormat fmt : ImageFormat.getAllFormats()) {
            // skip mysterious unknown entry
            if (fmt.getName().equalsIgnoreCase("unknown"))
                continue;
            String ext = fmt.getExtension().toLowerCase();
            addExtension(ext);
        }

        //      System.out.println(this.getClass().getName()+": "+extensions);
        return true;
    } catch (ClassNotFoundException e) {
        // eat it
    }

    return false;
}