public abstract class ImageReaderBase
extends javax.imageio.ImageReader
| Modifier and Type | Field and Description |
|---|---|
protected javax.imageio.stream.ImageInputStream |
imageInput
For convenience.
|
| Modifier | Constructor and Description |
|---|---|
protected |
ImageReaderBase(javax.imageio.spi.ImageReaderSpi provider)
Constructs an
ImageReader and sets its
originatingProvider field to the supplied value. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertInput()
Makes sure input is set.
|
protected void |
checkBounds(int index)
Convenience method to make sure image index is within bounds.
|
void |
dispose() |
protected static java.awt.image.BufferedImage |
fakeAOI(java.awt.image.BufferedImage pImage,
javax.imageio.ImageReadParam pParam)
Utility method for getting the area of interest (AOI) of an image.
|
protected static java.awt.Image |
fakeSubsampling(java.awt.Image pImage,
javax.imageio.ImageReadParam pParam)
Utility method for getting the subsampled image.
|
static java.awt.image.BufferedImage |
getDestination(javax.imageio.ImageReadParam param,
java.util.Iterator<javax.imageio.ImageTypeSpecifier> types,
int width,
int height)
Returns the
BufferedImage to which decoded pixel data should be written. |
javax.imageio.metadata.IIOMetadata |
getImageMetadata(int imageIndex)
Default implementation that always returns
null. |
int |
getNumImages(boolean allowSearch)
Default implementation that always returns
1. |
javax.imageio.metadata.IIOMetadata |
getStreamMetadata()
Default implementation that always returns
null. |
protected static boolean |
hasExplicitDestination(javax.imageio.ImageReadParam pParam)
Tests if param has explicit destination.
|
static void |
main(java.lang.String[] pArgs) |
void |
reset() |
protected abstract void |
resetMembers()
Resets all member variables.
|
void |
setInput(java.lang.Object input,
boolean seekForwardOnly,
boolean ignoreMetadata)
Overrides
setInput, to allow easy access to the input, in case
it is an ImageInputStream. |
protected static void |
showIt(java.awt.image.BufferedImage pImage,
java.lang.String pTitle) |
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, canReadRaster, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getDefaultReadParam, getFormatName, getHeight, getImageMetadata, getImageTypes, getInput, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getWidth, hasThumbnails, isIgnoringMetadata, isImageTiled, isRandomAccessEasy, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, read, read, readAll, readAll, readAsRenderedImage, readerSupportsThumbnails, readRaster, readThumbnail, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, setInput, setInput, setLocaleprotected javax.imageio.stream.ImageInputStream imageInput
ImageInputStream.setInput(Object, boolean, boolean)protected ImageReaderBase(javax.imageio.spi.ImageReaderSpi provider)
ImageReader and sets its
originatingProvider field to the supplied value.
Subclasses that make use of extensions should provide a
constructor with signature (ImageReaderSpi,
Object) in order to retrieve the extension object. If
the extension object is unsuitable, an
IllegalArgumentException should be thrown.
provider - the ImageReaderSpi that is invoking this constructor, or null.public void setInput(java.lang.Object input,
boolean seekForwardOnly,
boolean ignoreMetadata)
setInput, to allow easy access to the input, in case
it is an ImageInputStream.setInput in class javax.imageio.ImageReaderinput - the ImageInputStream or other
Object to use for future decoding.seekForwardOnly - if true, images and metadata
may only be read in ascending order from this input source.ignoreMetadata - if true, metadata
may be ignored during reads.java.lang.IllegalArgumentException - if input is
not an instance of one of the classes returned by the
originating service provider's getInputTypes
method, or is not an ImageInputStream.ImageInputStreampublic void dispose()
dispose in class javax.imageio.ImageReaderpublic void reset()
reset in class javax.imageio.ImageReaderprotected abstract void resetMembers()
public javax.imageio.metadata.IIOMetadata getImageMetadata(int imageIndex)
throws java.io.IOException
null.getImageMetadata in class javax.imageio.ImageReaderimageIndex - ignored, unless overriddennull, unless overriddenjava.io.IOException - never, unless overridden.public javax.imageio.metadata.IIOMetadata getStreamMetadata()
throws java.io.IOException
null.getStreamMetadata in class javax.imageio.ImageReadernull, unless overriddenjava.io.IOException - never, unless overridden.public int getNumImages(boolean allowSearch)
throws java.io.IOException
1.getNumImages in class javax.imageio.ImageReaderallowSearch - ignored, unless overridden1, unless overriddenjava.io.IOException - never, unless overriddenprotected void checkBounds(int index)
throws java.io.IOException
index - the image indexjava.io.IOException - if an error occurs during readingjava.lang.IndexOutOfBoundsException - if not minIndex <= index < numImagesprotected void assertInput()
java.lang.IllegalStateException - if getInput() == null.public static java.awt.image.BufferedImage getDestination(javax.imageio.ImageReadParam param,
java.util.Iterator<javax.imageio.ImageTypeSpecifier> types,
int width,
int height)
throws javax.imageio.IIOException
BufferedImage to which decoded pixel data should be written.
As ImageReader.getDestination(javax.imageio.ImageReadParam, java.util.Iterator<javax.imageio.ImageTypeSpecifier>, int, int) but tests if the explicit destination
image (if set) is valid according to the ImageTypeSpecifiers given in types.
param - an ImageReadParam to be used to get
the destination image or image type, or null.types - an Iterator of
ImageTypeSpecifiers indicating the legal image
types, with the default first.width - the true width of the image or tile begin decoded.height - the true width of the image or tile being decoded.BufferedImage to which decoded pixel
data should be written.javax.imageio.IIOException - if the ImageTypeSpecifier or BufferedImage
specified by param does not match any of the legal
ones from types.java.lang.IllegalArgumentException - if types
is null or empty, or if an object not of type
ImageTypeSpecifier is retrieved from it.
Or, if the resulting image would have a width or height less than 1,
or if the product of width and height of the resulting image is greater than
Integer.MAX_VALUE.protected static java.awt.image.BufferedImage fakeAOI(java.awt.image.BufferedImage pImage,
javax.imageio.ImageReadParam pParam)
IIOParam.setSourceRegion(java.awt.Rectangle)
method.
Note: If it is possible for the reader to read the AOI directly, such a method should be used instead, for efficiency.
pImage - the image to get AOI frompParam - the param optionally specifying the AOIBufferedImage containing the area of interest (source
region), or the original image, if no source region was set, or
pParam was nullprotected static java.awt.Image fakeSubsampling(java.awt.Image pImage,
javax.imageio.ImageReadParam pParam)
IIOParam.setSourceSubsampling(int, int, int, int)
method.
NOTE: This method does not take the subsampling offsets into consideration.
Note: If it is possible for the reader to subsample directly, such a method should be used instead, for efficiency.
pImage - the image to subsamplepParam - the param optionally specifying subsamplingImage containing the subsampled image, or the
original image, if no subsampling was specified, or
pParam was nullprotected static boolean hasExplicitDestination(javax.imageio.ImageReadParam pParam)
pParam - the image read parameter, or nullpParam is non-null and either its getDestination,
getDestinationType returns a non-null value,
or getDestinationOffset returns a Point that is not the upper left corner (0, 0).public static void main(java.lang.String[] pArgs)
throws java.io.IOException
java.io.IOExceptionprotected static void showIt(java.awt.image.BufferedImage pImage,
java.lang.String pTitle)
Copyright © 2020. All Rights Reserved.