001package javax.visrec; 002 003import java.io.File; 004import java.io.IOException; 005import java.io.InputStream; 006import java.net.URL; 007 008/** 009 * This interface provides a standard way to get/read different(specified) kinds of image from file, url or input stream. 010 * 011 * @author Zoran Sevarac 012 * @param <T> the type of object to be returned after getting image from {@link File}, {@link URL} or {@link InputStream} 013 * @since 1.0 014 */ 015public interface ImageFactory<T> { 016 017 /** 018 * Retrieve the source through a {@link File} object and transform it into T. 019 * @param file The source file. 020 * @return T object. 021 * @throws IOException If the file I/O went wrong or couldn't transform 022 * the source into a T object. 023 */ 024 T getImage(File file) throws IOException; 025 026 /** 027 * Retrieve the source through a {@link URL} object and transform it into T. 028 * @param file The source. 029 * @return T object. 030 * @throws IOException If the I/O went wrong or couldn't transform 031 * the source into a T object. 032 */ 033 T getImage(URL file) throws IOException; 034 035 /** 036 * Retrieve the source through an {@link InputStream} object and transform it into T. 037 * @param file The source. 038 * @return T object. 039 * @throws IOException If the I/O went wrong or couldn't transform 040 * the source into a T object. 041 */ 042 T getImage(InputStream file) throws IOException; 043 044}