ImageIO: getImageReadersByMIMEType(String MIMEType) : ImageIO « javax.imageio « Java by API






ImageIO: getImageReadersByMIMEType(String MIMEType)

  

import java.util.Iterator;

import javax.imageio.ImageIO;

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

    b = canReadMimeType("image/jpg"); // false
    b = canReadMimeType("image/jpeg"); // true
  }
  // Returns true if the specified mime type can be read
  public static boolean canReadMimeType(String mimeType) {
    Iterator iter = ImageIO.getImageReadersByMIMEType(mimeType);
    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: getImageReadersBySuffix(String fileSuffix)
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)