org.freehep.util.io.DCTInputStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of freehep-io Show documentation
Show all versions of freehep-io Show documentation
FreeHEP extension to the java.io library
// Copyright 2003-2009, FreeHEP.
package org.freehep.util.io;
import java.awt.Image;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.imageio.ImageIO;
/**
* Reads images from a JPEG Stream, but only images.
*
* @author Mark Donszelmann
*/
public class DCTInputStream extends FilterInputStream {
/**
* Creates a DCT input stream from the given input stream
*
* @param input
* stream to read from
*/
public DCTInputStream(InputStream input) {
super(input);
}
/**
* Read is not supported, only readImage.
*
* @see java.io.FilterInputStream#read()
*/
@Override
public int read() throws IOException {
throw new IOException(getClass()
+ ": read() not implemented, use readImage().");
}
/**
* @return image read
* @throws IOException
* if read fails
*/
public Image readImage() throws IOException {
return ImageIO.read(new NoCloseInputStream(this));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy