Class ImageDecoderImpl
java.lang.Object
org.apache.batik.ext.awt.image.codec.util.ImageDecoderImpl
- All Implemented Interfaces:
ImageDecoder
- Direct Known Subclasses:
PNGImageDecoder
A partial implementation of the
ImageDecoder interface
useful for subclassing.- Version:
- $Id$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SeekableStreamTheSeekableStreamassocicted with thisImageEncoder.protected ImageDecodeParamTheImageDecodeParamobject associated with thisImageEncoder. -
Constructor Summary
ConstructorsConstructorDescriptionImageDecoderImpl(InputStream input, ImageDecodeParam param) Constructs anImageDecoderImplwith a givenInputStreamandImageDecodeParaminstance.ImageDecoderImpl(SeekableStream input, ImageDecodeParam param) Constructs anImageDecoderImplwith a givenSeekableStreamandImageDecodeParaminstance. -
Method Summary
Modifier and TypeMethodDescriptionReturns aRasterthat contains the decoded contents of theSeekableStreamassociated with thisImageDecoder.decodeAsRaster(int page) Returns aRasterthat contains the decoded contents of theSeekableStreamassociated with thisImageDecoder.Returns aRenderedImagethat contains the decoded contents of theSeekableStreamassociated with thisImageDecoder.abstract RenderedImagedecodeAsRenderedImage(int page) Returns aRenderedImagethat contains the decoded contents of theSeekableStreamassociated with thisImageDecoder.Returns theSeekableStreamassociated with thisImageDecoder.intReturns the number of pages present in the current stream.getParam()Returns the current parameters as an instance of theImageDecodeParaminterface.voidsetParam(ImageDecodeParam param) Sets the current parameters to an instance of theImageDecodeParaminterface.
-
Field Details
-
input
TheSeekableStreamassocicted with thisImageEncoder. -
param
TheImageDecodeParamobject associated with thisImageEncoder.
-
-
Constructor Details
-
ImageDecoderImpl
Constructs anImageDecoderImplwith a givenSeekableStreamandImageDecodeParaminstance. -
ImageDecoderImpl
Constructs anImageDecoderImplwith a givenInputStreamandImageDecodeParaminstance. Theinputparameter will be used to construct aForwardSeekableStream; if the ability to seek backwards is required, the caller should construct an instance ofSeekableStreamand make use of the other contructor.
-
-
Method Details
-
getParam
Returns the current parameters as an instance of theImageDecodeParaminterface. Concrete implementations of this interface will return corresponding concrete implementations of theImageDecodeParaminterface. For example, aJPEGImageDecoderwill return an instance ofJPEGDecodeParam.- Specified by:
getParamin interfaceImageDecoder
-
setParam
Sets the current parameters to an instance of theImageDecodeParaminterface. Concrete implementations ofImageDecodermay throw aRuntimeExceptionif theparamargument is not an instance of the appropriate subclass or subinterface. For example, aJPEGImageDecoderwill expectparamto be an instance ofJPEGDecodeParam.- Specified by:
setParamin interfaceImageDecoder
-
getInputStream
Returns theSeekableStreamassociated with thisImageDecoder.- Specified by:
getInputStreamin interfaceImageDecoder
-
getNumPages
Returns the number of pages present in the current stream. By default, the return value is 1. Subclasses that deal with multi-page formats should override this method.- Specified by:
getNumPagesin interfaceImageDecoder- Throws:
IOException
-
decodeAsRaster
Returns aRasterthat contains the decoded contents of theSeekableStreamassociated with thisImageDecoder. Only the first page of a multi-page image is decoded.- Specified by:
decodeAsRasterin interfaceImageDecoder- Throws:
IOException
-
decodeAsRaster
Returns aRasterthat contains the decoded contents of theSeekableStreamassociated with thisImageDecoder. The given page of a multi-page image is decoded. If the page does not exist, an IOException will be thrown. Page numbering begins at zero.- Specified by:
decodeAsRasterin interfaceImageDecoder- Parameters:
page- The page to be decoded.- Throws:
IOException
-
decodeAsRenderedImage
Returns aRenderedImagethat contains the decoded contents of theSeekableStreamassociated with thisImageDecoder. Only the first page of a multi-page image is decoded.- Specified by:
decodeAsRenderedImagein interfaceImageDecoder- Throws:
IOException
-
decodeAsRenderedImage
Returns aRenderedImagethat contains the decoded contents of theSeekableStreamassociated with thisImageDecoder. The given page of a multi-page image is decoded. If the page does not exist, an IOException will be thrown. Page numbering begins at zero.- Specified by:
decodeAsRenderedImagein interfaceImageDecoder- Parameters:
page- The page to be decoded.- Throws:
IOException
-