ImageIO: getImageReadersBySuffix(String fileSuffix) : ImageIO « javax.imageio « Java by API






ImageIO: getImageReadersBySuffix(String fileSuffix)

  

import java.io.File;
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 = canReadExtension("foo"); // false
    b = canReadExtension("gif"); // true
    b = canReadExtension("giF"); // true
  }
  // Returns true if the specified file extension can be read
  public static boolean canReadExtension(String fileExt) {
    Iterator iter = ImageIO.getImageReadersBySuffix(fileExt);
    return iter.hasNext();
  }

}

   
    
  








Related examples in the same category

1.ImageIO: createImageInputStream(Object input)
2.ImageIO: getImageReaders(Object input)
3.ImageIO: getImageReadersByFormatName(String formatName)
4.ImageIO: getImageReadersByMIMEType(String MIMEType)
5.ImageIO: getImageWritersByFormatName(String formatName)
6.ImageIO: getImageWritersByMIMEType(String MIMEType)
7.ImageIO: getImageWritersBySuffix(String fileSuffix)
8.ImageIO: getReaderFormatNames()
9.ImageIO: getReaderMIMETypes()
10.ImageIO: getWriterFormatNames()
11.ImageIO: getWriterMIMETypes()
12.ImageIO: read(File input)
13.ImageIO: read(URL input)
14.ImageIO: write(RenderedImage im, String formatName, File output)