Class ImageEncoderImpl
java.lang.Object
org.apache.xmlgraphics.image.codec.util.ImageEncoderImpl
- All Implemented Interfaces:
ImageEncoder
- Direct Known Subclasses:
PNGImageEncoder, TIFFImageEncoder
A partial implementation of the ImageEncoder interface useful for
subclassing.
This class is not a committed part of the JAI API. It may be removed or changed in future releases of JAI.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OutputStreamThe OutputStream associcted with this ImageEncoder.protected ImageEncodeParamThe ImageEncodeParam object associcted with this ImageEncoder. -
Constructor Summary
ConstructorsConstructorDescriptionImageEncoderImpl(OutputStream output, ImageEncodeParam param) Constructs an ImageEncoderImpl with a given OutputStream and ImageEncoderParam instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidencode(Raster ras, ColorModel cm) Encodes a Raster with a given ColorModel and writes the output to the OutputStream associated with this ImageEncoder.abstract voidencode(RenderedImage im) Encodes a RenderedImage and writes the output to the OutputStream associated with this ImageEncoder.Returns the OutputStream associated with this ImageEncoder.getParam()Returns the current parameters as an instance of the ImageEncodeParam interface.voidsetParam(ImageEncodeParam param) Sets the current parameters to an instance of the ImageEncodeParam interface.
-
Field Details
-
output
The OutputStream associcted with this ImageEncoder. -
param
The ImageEncodeParam object associcted with this ImageEncoder.
-
-
Constructor Details
-
ImageEncoderImpl
Constructs an ImageEncoderImpl with a given OutputStream and ImageEncoderParam instance.
-
-
Method Details
-
getParam
Returns the current parameters as an instance of the ImageEncodeParam interface. Concrete implementations of this interface will return corresponding concrete implementations of the ImageEncodeParam interface. For example, a JPEGImageEncoder will return an instance of JPEGEncodeParam.- Specified by:
getParamin interfaceImageEncoder
-
setParam
Sets the current parameters to an instance of the ImageEncodeParam interface. Concrete implementations of ImageEncoder may throw a RuntimeException if the params argument is not an instance of the appropriate subclass or subinterface. For example, a JPEGImageEncoder will expect param to be an instance of JPEGEncodeParam.- Specified by:
setParamin interfaceImageEncoder
-
getOutputStream
Returns the OutputStream associated with this ImageEncoder.- Specified by:
getOutputStreamin interfaceImageEncoder
-
encode
Encodes a Raster with a given ColorModel and writes the output to the OutputStream associated with this ImageEncoder.- Specified by:
encodein interfaceImageEncoder- Throws:
IOException
-
encode
Encodes a RenderedImage and writes the output to the OutputStream associated with this ImageEncoder.- Specified by:
encodein interfaceImageEncoder- Throws:
IOException
-