    001package visrec.ri;
    002
    003import javax.imageio.ImageIO;
    004import javax.visrec.ImageFactory;
    005import java.awt.image.BufferedImage;
    006import java.io.File;
    007import java.io.IOException;
    008import java.io.InputStream;
    009import java.net.URL;
    010
    011/**
    012 * {@link ImageFactory} to provide {@link BufferedImage} as return object.
    013 * @author Kevin Berendsen
    014 */
    015public class BufferedImageImageFactory implements ImageFactory<BufferedImage> {
    016
    017    /** {@inheritDoc} */
    018    @Override
    019    public BufferedImage getImage(File file) throws IOException {
    020        return ImageIO.read(file);
    021    }
    022
    023    /** {@inheritDoc} */
    024    @Override
    025    public BufferedImage getImage(URL file) throws IOException {
    026        return ImageIO.read(file);
    027    }
    028
    029    /** {@inheritDoc} */
    030    @Override
    031    public BufferedImage getImage(InputStream file) throws IOException {
    032        return ImageIO.read(file);
    033    }
    034}