Class java.awt.image.codec.JPEGImageEncoder
java.lang.Object
|
+----java.awt.image.codec.JPEGImageEncoder
- public class JPEGImageEncoder
- extends Object
JPEGImageEncoder encodes buffers of image data into JPEG data
streams. Essentially users of this class are required to provide image
data in a Raster object or a BufferedImage, set the necessary parameters
in the JPEGParams object and successfully open the
OutputStream
that is the destination of the encoded jpeg
stream.
The JPEGImageEncoder class will encode Rasters of image data into
interchange, and abbreviated JPEG data streams that are written to the
OutputStream provided to the encoder.
- See Also:
- JPEGParam, Raster, BufferedImage, OutputStream
Method Summary
|
void
|
encode()
Encodes the data that is encapsulated by the Raster or BufferedImage according
to the settings of the JPEGParam, and writes the information to the OutputStream.
|
JPEGParam
|
getJPEGParam()
getJPEGParam()- returns the current JPEGParam data member.
|
void
|
setJPEGParam(JPEGParam p)
Allows users to set the JPEGParam object that contains the information
used to encode image data.
|
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JPEGImageEncoder
public JPEGImageEncoder(Raster src,
OutputStream dest)
- Constructs a JPEGImageEncoder using a Raster dataa source and destination
OutputStream.
- Parameters:
src
- - the Raster containing the image data to be encoded.
dest
- - destination of the encoded data.
JPEGImageEncoder
public JPEGImageEncoder(BufferedImage src,
OutputStream dest)
- Constructs a JPEGImageEncoder specifying the BufferedImage data source
and destination OutputStream.
- Parameters:
src
- - the BufferedImage containing the data to be encoded
dest
- - destination of the encoded data.
JPEGImageEncoder
public JPEGImageEncoder(OutputStream dest)
- Constructor to be used when tables only
data is being written.
- Parameters:
dest
- - destination of the encoded data.
encode
public void encode() throws IOException
- Encodes the data that is encapsulated by the Raster or BufferedImage according
to the settings of the JPEGParam, and writes the information to the OutputStream.
Used for writing Interchange jpeg streams ( standard jpeg/jfif files ) and
abbreviated image streams. Note to write the image data in an abbrevieated
JPEG stream set the value of JPEGParam.write_tables = false. This will suppress
writing of the Quantization and Huffman tables.
- Returns:
- void
- Throws:
- - - throws IOException if there are errors writing the encoded data.
getJPEGParam
public JPEGParam getJPEGParam()
- getJPEGParam()- returns the current JPEGParam data member.
- Returns:
- params - the current JPEGParam
setJPEGParam
public void setJPEGParam(JPEGParam p)
- Allows users to set the JPEGParam object that contains the information
used to encode image data.
- Parameters:
p
- - new value assigned to the params member.
- Returns:
- void
- Throws:
- none -
Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.