tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Java > Image IO > How to get supported suffixes

How to get supported suffixes 

Java Image IO provides pluggable architecture for accessing images transparently. It is simple, flexible and allows us to plugin various image readers and writers with ease. The following example shows getting supported image file suffixes, format names and mime types.

File Name  :  
com/bethecoder/tutorials/imageio/SupportedSuffixesTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.imageio;

import java.util.Arrays;
import javax.imageio.ImageIO;

public class SupportedSuffixesTest {

  /**
   @param args
   */
  public static void main(String[] args) {

    //file suffixes associated with the formats understood
      //by the current set of registered readers.
    System.out.println(Arrays.toString(ImageIO.getReaderFileSuffixes()));
    
    //file suffixes associated with the formats understood
    //by the current set of registered writers.
    System.out.println(Arrays.toString(ImageIO.getWriterFileSuffixes()));
    
    //Format names understood by the current set of registered readers.
    System.out.println(Arrays.toString(ImageIO.getReaderFormatNames()));
    
    //Format names understood by the current set of registered writers.
    System.out.println(Arrays.toString(ImageIO.getWriterFormatNames()));
    
    //MIME types understood by the current set of registered readers.
    System.out.println(Arrays.toString(ImageIO.getReaderMIMETypes()));
    
    //MIME types understood by the current set of registered writers.
    System.out.println(Arrays.toString(ImageIO.getWriterMIMETypes()));
  }

}
   

It gives the following output,
[bmp, jpg, jpeg, wbmp, png, gif]
[bmp, jpg, wbmp, jpeg, png, gif]
[BMP, bmp, jpg, JPG, jpeg, wbmp, png, JPEG, PNG, WBMP, GIF, gif]
[BMP, bmp, jpg, JPG, wbmp, jpeg, png, PNG, JPEG, WBMP, GIF, gif]
[image/jpeg, image/png, image/x-png, image/vnd.wap.wbmp, image/bmp, image/gif]
[image/png, image/jpeg, image/x-png, image/vnd.wap.wbmp, image/gif, image/bmp]



 
  


  
bl  br