Debian Codegraph @

src/main/java/org/freehep/util/io/DCTInputStream.java

raw
1 // Copyright 2003, FreeHEP.
2 package org.freehep.util.io;
3
4 import java.awt.Image;
5 import java.io.FilterInputStream;
6 import java.io.IOException;
7 import java.io.InputStream;
8
9 import javax.imageio.ImageIO;
10
11 /**
12 * Reads images from a JPEG Stream, but only images.
13 *
14 * @author Mark Donszelmann
15 * @version $Id: DCTInputStream.java 8584 2006-08-10 23:06:37Z duns $
16 */
17 /**
18 * @author duns
19 *
20 */
21 public class DCTInputStream extends FilterInputStream {
22
23 /**
24 * Creates a DCT input stream from the given input stream
25 *
26 * @param input stream to read from
27 */
28 public DCTInputStream(InputStream input) {
29 super(input);
30 }
31
32 /**
33 * Read is not supported, only readImage.
34 *
35 * @see java.io.FilterInputStream#read()
36 */
37 public int read() throws IOException {
38 throw new IOException(getClass()
39 + ": read() not implemented, use readImage().");
40 }
41
42 /**
43 * @return image read
44 * @throws IOException if read fails
45 */
46 public Image readImage() throws IOException {
47 return ImageIO.read(new NoCloseInputStream(this));
48 }
49 }