Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Iterator;

import javax.imageio.ImageIO;

public class Main {
    public static void main(String[] argv) throws Exception {
        boolean b;

        // Check availability using a format name
        b = canWriteFormat("foo"); // false
        b = canWriteFormat("gif"); // true
        b = canWriteFormat("giF"); // true
    }

    public static boolean canWriteFormat(String formatName) {
        Iterator iter = ImageIO.getImageWritersByFormatName(formatName);
        return iter.hasNext();
    }

}