Files
narya/src/java/com/threerings/media/image/ImageIOLoader.java
T
Michael Bayne 2c1e5c1ba5 Bollocks! I forgot that using the memory cache with the ImageIO stuff
somehow borks the zip decompressor and all hell breaks loose. What a PITA.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@772 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-12-13 07:31:53 +00:00

39 lines
1.1 KiB
Java

//
// $Id: ImageIOLoader.java,v 1.4 2001/12/13 07:31:53 mdb Exp $
package com.threerings.media;
import java.awt.Image;
import java.io.IOException;
import java.io.InputStream;
import javax.imageio.ImageIO;
/**
* Loads images using the <code>ImageIO</code> services provided by J2SE
* 1.4 (and, presumably, above).
*/
public class ImageIOLoader implements ImageLoader
{
public ImageIOLoader ()
{
// we need to reference ImageIO in the constructor to force the
// classloader to attempt to load the ImageIO classes
ImageIO.setUseCache(true);
}
// documentation inherited
public Image loadImage (InputStream source)
throws IOException
{
// this seems to choke when decoding the compressed image data
// which may mean it's a JDK bug or something, but I'd like to see
// it resolved so that the image manager will work on applets
//
// ImageInputStream iis = new MemoryCacheImageInputStream(source);
// return ImageIO.read(iis);
return ImageIO.read(source);
}
}