Home Java Example Java Swing Graphics2D Show Image Reader and Image Writer by MIME Type
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Show Image Reader and Image Writer by MIME Type

Advertisement
To show the image reader and image writer by MIME Type, we have used ImageIO class of the package javax.imageio.*.

Show Image Reader and Image Writer by MIME Type

     

This section illustrates you how to display the Image Reader and Image Writer by by MIME Type. 

To show the image reader and image writer by MIME Type, we have used ImageIO class of the package javax.imageio.*. The ImageIO class provides the methods for locating ImageReaders and ImageWriters.

The method getReaderMIMETypes() of class ImageIO returns an array of strings consisting of all the image MIME types which the current set of registered readers understands. The method getWriterMIMETypes() returns an array of strings consisting of all the image MIME types which the current set of registered writers understands.

Here is the code of ShowImageIOMimeType.java

import javax.imageio.*;

public class ShowImageIOMimeType {
  public static  void main(String args[])throws Exception{
  System.out.println("For Reading:");
  String reader[] = ImageIO.getReaderMIMETypes();
  for (int k = 0; k < reader.length; k++) {
  System.out.println(" MIME Types: " + reader[k]);
  }
  System.out.println("For Writing:");
  reader = ImageIO.getWriterMIMETypes();
  for (int k = 0; k < reader.length; k++) {
  System.out.println("MIME Types: " + reader[k]);
  }
  }
}

Output will be displayed on the console:

Download Source Code

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 15, 2008

Related Tutorials

Ask Questions?    Discuss: Show Image Reader and Image Writer by MIME Type  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com