Class ImageDecoderImpl
- java.lang.Object
-
- org.apache.batik.ext.awt.image.codec.util.ImageDecoderImpl
-
- All Implemented Interfaces:
ImageDecoder
- Direct Known Subclasses:
PNGImageDecoder
public abstract class ImageDecoderImpl extends java.lang.Object implements ImageDecoder
A partial implementation of theImageDecoderinterface useful for subclassing.- Version:
- $Id: ImageDecoderImpl.java 1733416 2016-03-03 07:07:13Z gadams $
-
-
Field Summary
Fields Modifier and Type Field Description protected SeekableStreaminputTheSeekableStreamassocicted with thisImageEncoder.protected ImageDecodeParamparamTheImageDecodeParamobject associated with thisImageEncoder.
-
Constructor Summary
Constructors Constructor Description ImageDecoderImpl(java.io.InputStream input, ImageDecodeParam param)Constructs anImageDecoderImplwith a givenInputStreamandImageDecodeParaminstance.ImageDecoderImpl(SeekableStream input, ImageDecodeParam param)Constructs anImageDecoderImplwith a givenSeekableStreamandImageDecodeParaminstance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.awt.image.RasterdecodeAsRaster()Returns aRasterthat contains the decoded contents of theSeekableStreamassociated with thisImageDecoder.java.awt.image.RasterdecodeAsRaster(int page)Returns aRasterthat contains the decoded contents of theSeekableStreamassociated with thisImageDecoder.java.awt.image.RenderedImagedecodeAsRenderedImage()Returns aRenderedImagethat contains the decoded contents of theSeekableStreamassociated with thisImageDecoder.abstract java.awt.image.RenderedImagedecodeAsRenderedImage(int page)Returns aRenderedImagethat contains the decoded contents of theSeekableStreamassociated with thisImageDecoder.SeekableStreamgetInputStream()Returns theSeekableStreamassociated with thisImageDecoder.intgetNumPages()Returns the number of pages present in the current stream.ImageDecodeParamgetParam()Returns the current parameters as an instance of theImageDecodeParaminterface.voidsetParam(ImageDecodeParam param)Sets the current parameters to an instance of theImageDecodeParaminterface.
-
-
-
Field Detail
-
input
protected SeekableStream input
TheSeekableStreamassocicted with thisImageEncoder.
-
param
protected ImageDecodeParam param
TheImageDecodeParamobject associated with thisImageEncoder.
-
-
Constructor Detail
-
ImageDecoderImpl
public ImageDecoderImpl(SeekableStream input, ImageDecodeParam param)
Constructs anImageDecoderImplwith a givenSeekableStreamandImageDecodeParaminstance.
-
ImageDecoderImpl
public ImageDecoderImpl(java.io.InputStream input, ImageDecodeParam param)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 Detail
-
getParam
public ImageDecodeParam 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
public void setParam(ImageDecodeParam param)
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
public SeekableStream getInputStream()
Returns theSeekableStreamassociated with thisImageDecoder.- Specified by:
getInputStreamin interfaceImageDecoder
-
getNumPages
public int getNumPages() throws java.io.IOExceptionReturns 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:
java.io.IOException
-
decodeAsRaster
public java.awt.image.Raster decodeAsRaster() throws java.io.IOExceptionReturns 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:
java.io.IOException
-
decodeAsRaster
public java.awt.image.Raster decodeAsRaster(int page) throws java.io.IOExceptionReturns 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:
java.io.IOException
-
decodeAsRenderedImage
public java.awt.image.RenderedImage decodeAsRenderedImage() throws java.io.IOExceptionReturns 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:
java.io.IOException
-
decodeAsRenderedImage
public abstract java.awt.image.RenderedImage decodeAsRenderedImage(int page) throws java.io.IOExceptionReturns 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:
java.io.IOException
-
-