1 7 8 package org.jboss.media.format.image.iio; 9 10 import java.util.HashMap ; 11 import java.util.Iterator ; 12 import java.util.Map ; 13 14 import javax.imageio.ImageIO ; 15 import javax.imageio.ImageReader ; 16 17 23 public class IIOMediaFormatFactory 24 { 25 public static Map createMediaFormats() 26 { 27 Map mediaFormats = new HashMap (); 28 29 Iterator imageReaders = ImageIO.getImageReadersByFormatName("png"); 31 ImageReader imageReader = (ImageReader ) imageReaders.next(); 32 mediaFormats.put("png", new PNGMediaFormat(imageReader)); 33 34 42 43 return mediaFormats; 44 } 45 46 private static ImageReader getImageReaderByFormatName(String formatName) 47 { 48 Iterator imageReaders = ImageIO.getImageReadersByFormatName(formatName); 49 return (ImageReader ) imageReaders.next(); 50 } 51 } 52 | Popular Tags |