com.pearsoneduc.ip.io
Class JPEGEncoder

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

public class JPEGEncoder
extends java.lang.Object
implements ImageEncoder

Writes image data to a stream or file encoded in the JPEG format. This class is merely a wrapper for the JPEGImageEncoder class in the com.sun.image.codec.jpeg package.

Version:
1.0 [1999/06/28]
Author:
Nick Efford
See Also:
JPEGEncoderException, JPEGDecoder, BufferedImage, com.sun.image.codec.jpeg.JPEGImageEncoder

Constructor Summary
JPEGEncoder()
          Constructs a JPEGEncoder that writes to standard output.
JPEGEncoder(java.io.OutputStream out)
          Constructors a JPEGEncoder that writes to the specified OutputStream.
JPEGEncoder(java.lang.String imgfile)
          Constructs a JPEGEncoder that writes to a named file.
 
Method Summary
 void encode(java.awt.image.BufferedImage image)
          Encodes the specified image in JPEG File Interchange Format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPEGEncoder

public JPEGEncoder()
Constructs a JPEGEncoder that writes to standard output.

JPEGEncoder

public JPEGEncoder(java.io.OutputStream out)
Constructors a JPEGEncoder that writes to the specified OutputStream.
Parameters:
out - stream to which JPEG-compressed data will be written

JPEGEncoder

public JPEGEncoder(java.lang.String imgfile)
            throws java.io.FileNotFoundException
Constructs a JPEGEncoder that writes to a named file.
Parameters:
imgfile - name of the image file
Throws:
java.io.FileNotFoundException - if the file cannot be accessed.
Method Detail

encode

public void encode(java.awt.image.BufferedImage image)
            throws java.io.IOException,
                   JPEGEncoderException
Encodes the specified image in JPEG File Interchange Format.
Specified by:
encode in interface ImageEncoder
Parameters:
image - the image to be encoded
Throws:
java.io.IOException - if data could not be written to the stream.
JPEGEncoderException - if the image cannot be written in this format.