com.pearsoneduc.ip.io
Class JPEGDecoder

java.lang.Object
  |
  +--com.pearsoneduc.ip.io.JPEGDecoder

public class JPEGDecoder
extends java.lang.Object
implements ImageDecoder

Reads image data in JPEG format from a stream or a file. This class is simply a wrapper for the decoder provided in the com.sun.image.codec.jpeg package.

Version:
1.0 [1999/06/28]
Author:
Nick Efford
See Also:
JPEGDecoderException, JPEGEncoder, BufferedImage, com.sun.image.codec.jpeg.JPEGImageDecoder

Constructor Summary
JPEGDecoder()
          Constructs a JPEGDecoder that reads from standard input.
JPEGDecoder(java.io.InputStream in)
          Constructs a JPEGDecoder that reads from the specified InputStream.
JPEGDecoder(java.lang.String imgfile)
          Constructs a JPEGDecoder that reads from a named file.
 
Method Summary
 java.awt.image.BufferedImage decodeAsBufferedImage()
          Decodes the input data and creates an image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPEGDecoder

public JPEGDecoder()
Constructs a JPEGDecoder that reads from standard input.

JPEGDecoder

public JPEGDecoder(java.io.InputStream in)
Constructs a JPEGDecoder that reads from the specified InputStream.
Parameters:
in - the InputStream from which data will be read

JPEGDecoder

public JPEGDecoder(java.lang.String imgfile)
            throws java.io.FileNotFoundException
Constructs a JPEGDecoder that reads from a named file.
Parameters:
imgfile - name of the file containing the image data
Throws:
java.io.FileNotFoundException - if the file cannot be accessed.
Method Detail

decodeAsBufferedImage

public java.awt.image.BufferedImage decodeAsBufferedImage()
                                                   throws java.io.IOException,
                                                          JPEGDecoderException
Decodes the input data and creates an image.
Specified by:
decodeAsBufferedImage in interface ImageDecoder
Returns:
a BufferedImage containing the data
Throws:
java.io.IOException - if there was a problem reading the datastream.
JPEGDecoderException - if there were irregularities in the datastream.