com.sun.image.codec.jpeg
Interface JPEGImageDecoder


public interface JPEGImageDecoder

This interface describes a JPEG data stream decoder. This decoder takes an InputStream that contains JPEG encoded image data. The JPEGImageDecoder will decode the JPEG image data according to the parameters set in a JPEGDecodeParam object. The resulting image data is returned in either a Raster or a BufferedImage.

Note that the classes in the com.sun.image.codec.jpeg package are not part of the core Java APIs. They are a part of Sun's JDK and JRE distributions. Although other licensees may choose to distribute these classes, developers cannot depend on their availability in non-Sun implementations. We expect that equivalent functionality will eventually be available in a core API or standard extension.

See Also:
JPEGCodec, JPEGDecodeParam, Raster, BufferedImage

Method Summary
 BufferedImage decodeAsBufferedImage()
          Decodes the current JPEG data stream.
 Raster decodeAsRaster()
          Decode the JPEG stream that was passed as part of construction.
 InputStream getInputStream()
          Get the input stream that decoding will occur from.
 JPEGDecodeParam getJPEGDecodeParam()
          Returns the JPEGDecodeParam object that resulted from the most recent decoding event.
 void setJPEGDecodeParam(JPEGDecodeParam jdp)
          Sets the JPEGDecodeParam object used to determine the features of the decompression performed on the JPEG encoded data.
 

Method Detail

getJPEGDecodeParam

public JPEGDecodeParam getJPEGDecodeParam()
Returns the JPEGDecodeParam object that resulted from the most recent decoding event.


setJPEGDecodeParam

public void setJPEGDecodeParam(JPEGDecodeParam jdp)
Sets the JPEGDecodeParam object used to determine the features of the decompression performed on the JPEG encoded data. This is ussually only needed for decoding abbreviated JPEG data streams.

Parameters:
jdp - JPEGDecodeParam object

getInputStream

public InputStream getInputStream()
Get the input stream that decoding will occur from.

Returns:
The stream that the decoder is currently assciated with.

decodeAsRaster

public Raster decodeAsRaster()
                      throws IOException,
                             ImageFormatException
Decode the JPEG stream that was passed as part of construction. The JPEG decompression will be performed according to the current settings of the JPEGDecodeParam object. For a tables only stream this will return null.

Returns:
Raster containg the image data. Colorspace and other pertinent information can be obtained from the JPEGDecodeParam object.
Throws:
ImageFormatException - if irregularities in the JPEG stream or an unknown condition is encountered.
IOException

decodeAsBufferedImage

public BufferedImage decodeAsBufferedImage()
                                    throws IOException,
                                           ImageFormatException
Decodes the current JPEG data stream. The result of decoding this InputStream is a BufferedImage the ColorModel associated with this BufferedImage is determined based on the encoded COLOR_ID of the JPEGDecodeParam object. For a tables only stream this will return null.

Returns:
BufferedImage containing the image data.
Throws:
ImageFormatException - if irregularities in the JPEG stream or an unknown condition is encountered.
IOException


Submit a bug or feature
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2003 Sun Microsystems, Inc. 4150 Network Circle
Santa Clara, California, 95054, U.S.A. All Rights Reserved.