public abstract class ImageReader extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Locale[] |
availableLocales
All locales available for localization of warning messages, or
null if localization is not supported.
|
protected boolean |
ignoreMetadata
true if the input source does not require metadata to be read,
false otherwise.
|
protected java.lang.Object |
input
An ImageInputStream from which image data is read.
|
protected java.util.Locale |
locale
The current locale used to localize warning messages, or null if
no locale has been set.
|
protected int |
minIndex
The minimum index at which data can be read.
|
protected javax.imageio.spi.ImageReaderSpi |
originatingProvider
The image reader SPI that instantiated this reader.
|
protected java.util.List<javax.imageio.event.IIOReadProgressListener> |
progressListeners
A list of installed progress listeners.
|
protected boolean |
seekForwardOnly
true if this reader should only read data further ahead in the
stream than its current location.
|
protected java.util.List<javax.imageio.event.IIOReadUpdateListener> |
updateListeners
A list of installed update listeners.
|
protected java.util.List<javax.imageio.event.IIOReadWarningListener> |
warningListeners
A list of installed warning listeners.
|
protected java.util.List<java.util.Locale> |
warningLocales
A list of warning locales corresponding with the list of
installed warning listeners.
|
| Modifier | Constructor and Description |
|---|---|
protected |
ImageReader(javax.imageio.spi.ImageReaderSpi originatingProvider)
Construct an image reader.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Request that reading be aborted.
|
protected boolean |
abortRequested()
Check if the abort flag is set.
|
void |
addIIOReadProgressListener(javax.imageio.event.IIOReadProgressListener listener)
Install a read progress listener.
|
void |
addIIOReadUpdateListener(javax.imageio.event.IIOReadUpdateListener listener)
Install a read update listener.
|
void |
addIIOReadWarningListener(javax.imageio.event.IIOReadWarningListener listener)
Install a read warning listener.
|
boolean |
canReadRaster()
Check if this reader can handle raster data.
|
protected static void |
checkReadParamBandSettings(ImageReadParam param,
int numSrcBands,
int numDstBands)
Check that the given read parameters have valid source and
destination band settings.
|
protected void |
clearAbortRequest()
Clear the abort flag.
|
protected static void |
computeRegions(ImageReadParam param,
int srcWidth,
int srcHeight,
java.awt.image.BufferedImage image,
java.awt.Rectangle srcRegion,
java.awt.Rectangle destRegion)
Calcluate the source and destination regions that will be read
from and written to, given image parameters and/or a destination
buffered image.
|
void |
dispose()
Releases any resources allocated to this object.
|
float |
getAspectRatio(int imageIndex)
Returns the aspect ratio of this image, the ration of its width
to its height.
|
java.util.Locale[] |
getAvailableLocales()
Retrieve the available locales.
|
ImageReadParam |
getDefaultReadParam()
Retrieve the default read parameters for this reader's image
format.
|
protected static java.awt.image.BufferedImage |
getDestination(ImageReadParam param,
java.util.Iterator<ImageTypeSpecifier> imageTypes,
int width,
int height)
Return a suitable destination buffered image.
|
java.lang.String |
getFormatName()
Retrieve the format of the input source.
|
abstract int |
getHeight(int imageIndex)
Get the height of the input image in pixels.
|
abstract javax.imageio.metadata.IIOMetadata |
getImageMetadata(int imageIndex)
Get the metadata associated with this image.
|
javax.imageio.metadata.IIOMetadata |
getImageMetadata(int imageIndex,
java.lang.String formatName,
java.util.Set<java.lang.String> nodeNames)
Get the metadata associated with this image.
|
abstract java.util.Iterator<ImageTypeSpecifier> |
getImageTypes(int imageIndex)
Get an iterator over the collection of image types into which
this reader can decode image data.
|
java.lang.Object |
getInput()
Get this reader's image input source.
|
java.util.Locale |
getLocale()
Get this reader's locale.
|
int |
getMinIndex()
Get the index at which the next image will be read.
|
abstract int |
getNumImages(boolean allowSearch)
Return the number of images available from the image input
source, not including thumbnails.
|
int |
getNumThumbnails(int imageIndex)
Get the number of thumbnails associated with an image.
|
javax.imageio.spi.ImageReaderSpi |
getOriginatingProvider()
Get the ImageReaderSpi that created this reader or null.
|
ImageTypeSpecifier |
getRawImageType(int imageIndex)
Get the image type specifier that most closely represents the
internal data representation used by this reader.
|
protected static java.awt.Rectangle |
getSourceRegion(ImageReadParam param,
int srcWidth,
int srcHeight)
Calculate a source region based on the given source image
dimensions and parameters.
|
abstract javax.imageio.metadata.IIOMetadata |
getStreamMetadata()
Get the metadata associated with the image being read.
|
javax.imageio.metadata.IIOMetadata |
getStreamMetadata(java.lang.String formatName,
java.util.Set<java.lang.String> nodeNames)
Get the metadata associated with the image being read.
|
int |
getThumbnailHeight(int imageIndex,
int thumbnailIndex)
Get the height of a thumbnail image.
|
int |
getThumbnailWidth(int imageIndex,
int thumbnailIndex)
Get the width of a thumbnail image.
|
int |
getTileGridXOffset(int imageIndex)
Get the X coordinate in pixels of the top-left corner of the
first tile in this image.
|
int |
getTileGridYOffset(int imageIndex)
Get the Y coordinate in pixels of the top-left corner of the
first tile in this image.
|
int |
getTileHeight(int imageIndex)
Get the height of an image tile.
|
int |
getTileWidth(int imageIndex)
Get the width of an image tile.
|
abstract int |
getWidth(int imageIndex)
Get the width of the input image in pixels.
|
boolean |
hasThumbnails(int imageIndex)
Check whether or not the given image has thumbnails associated
with it.
|
boolean |
isIgnoringMetadata()
Check if this image reader ignores metadata.
|
boolean |
isImageTiled(int imageIndex)
Check if the given image is sub-divided into equal-sized
non-overlapping pixel rectangles.
|
boolean |
isRandomAccessEasy(int imageIndex)
Check if all pixels in this image are readily accessible.
|
boolean |
isSeekForwardOnly()
Check if this image reader may only seek forward within the input
stream.
|
protected void |
processImageComplete()
Notifies all installed read progress listeners that image loading
has completed by calling their imageComplete methods.
|
protected void |
processImageProgress(float percentageDone)
Notifies all installed read progress listeners that a certain
percentage of the image has been loaded, by calling their
imageProgress methods.
|
protected void |
processImageStarted(int imageIndex)
Notifies all installed read progress listeners, by calling their
imageStarted methods, that image loading has started on the given
image.
|
protected void |
processImageUpdate(java.awt.image.BufferedImage image,
int minX,
int minY,
int width,
int height,
int periodX,
int periodY,
int[] bands)
Notifies all installed read update listeners, by calling their
imageUpdate methods, that the set of samples has changed.
|
protected void |
processPassComplete(java.awt.image.BufferedImage image)
Notifies all installed update progress listeners, by calling
their passComplete methods, that a progressive pass has
completed.
|
protected void |
processPassStarted(java.awt.image.BufferedImage image,
int pass,
int minPass,
int maxPass,
int minX,
int minY,
int periodX,
int periodY,
int[] bands)
Notifies all installed read update listeners, by calling their
passStarted methods, that a new pass has begun.
|
protected void |
processReadAborted()
Notifies all installed read progress listeners that image loading
has been aborted by calling their readAborted methods.
|
protected void |
processSequenceComplete()
Notifies all installed read progress listeners, by calling their
sequenceComplete methods, that a sequence of images has completed
loading.
|
protected void |
processSequenceStarted(int minIndex)
Notifies all installed read progress listeners, by calling their
sequenceStarted methods, a sequence of images has started
loading.
|
protected void |
processThumbnailComplete()
Notifies all installed read progress listeners, by calling their
thumbnailComplete methods, that a thumbnail has completed
loading.
|
protected void |
processThumbnailPassComplete(java.awt.image.BufferedImage thumbnail)
Notifies all installed update progress listeners, by calling
their thumbnailPassComplete methods, that a progressive pass has
completed on a thumbnail.
|
protected void |
processThumbnailPassStarted(java.awt.image.BufferedImage thumbnail,
int pass,
int minPass,
int maxPass,
int minX,
int minY,
int periodX,
int periodY,
int[] bands)
Notifies all installed read update listeners, by calling their
thumbnailPassStarted methods, that a new pass has begun.
|
protected void |
processThumbnailProgress(float percentageDone)
Notifies all installed read progress listeners that a certain
percentage of a thumbnail has been loaded, by calling their
thumbnailProgress methods.
|
protected void |
processThumbnailStarted(int imageIndex,
int thumbnailIndex)
Notifies all installed read progress listeners, by calling their
imageStarted methods, that thumbnail loading has started on the
given thumbnail of the given image.
|
protected void |
processThumbnailUpdate(java.awt.image.BufferedImage image,
int minX,
int minY,
int width,
int height,
int periodX,
int periodY,
int[] bands)
Notifies all installed read update listeners, by calling their
thumbnailUpdate methods, that the set of samples has changed.
|
protected void |
processWarningOccurred(java.lang.String warning)
Notifies all installed warning listeners, by calling their
warningOccurred methods, that a warning message has been raised.
|
protected void |
processWarningOccurred(java.lang.String baseName,
java.lang.String keyword)
Notify all installed warning listeners, by calling their
warningOccurred methods, that a warning message has been raised.
|
java.awt.image.BufferedImage |
read(int imageIndex)
Read the given frame all at once, using default image read
parameters, and return a buffered image.
|
abstract java.awt.image.BufferedImage |
read(int imageIndex,
ImageReadParam param)
Read the given frame into a buffered image using the given read
parameters.
|
IIOImage |
readAll(int imageIndex,
ImageReadParam param)
Read the given frame all at once, using the given image read
parameters, and return an IIOImage.
|
java.util.Iterator<IIOImage> |
readAll(java.util.Iterator<? extends ImageReadParam> params)
Read all image frames all at once, using the given image read
parameters iterator, and return an iterator over a collection of
IIOImages.
|
java.awt.image.RenderedImage |
readAsRenderedImage(int imageIndex,
ImageReadParam param)
Read a rendered image.
|
boolean |
readerSupportsThumbnails()
Check if this reader supports reading thumbnails.
|
java.awt.image.Raster |
readRaster(int imageIndex,
ImageReadParam param)
Read raw raster data.
|
java.awt.image.BufferedImage |
readThumbnail(int imageIndex,
int thumbnailIndex)
Read a thumbnail.
|
java.awt.image.BufferedImage |
readTile(int imageIndex,
int tileX,
int tileY)
Read the given tile into a buffered image.
|
java.awt.image.Raster |
readTileRaster(int imageIndex,
int tileX,
int tileY)
Read the given tile into a raster containing the raw image data.
|
void |
removeAllIIOReadProgressListeners()
Uninstall all read progress listeners.
|
void |
removeAllIIOReadUpdateListeners()
Uninstall all read update listeners.
|
void |
removeAllIIOReadWarningListeners()
Uninstall all read warning listeners.
|
void |
removeIIOReadProgressListener(javax.imageio.event.IIOReadProgressListener listener)
Uninstall the given read progress listener.
|
void |
removeIIOReadUpdateListener(javax.imageio.event.IIOReadUpdateListener listener)
Uninstall the given read update listener.
|
void |
removeIIOReadWarningListener(javax.imageio.event.IIOReadWarningListener listener)
Uninstall the given read warning listener.
|
void |
reset()
Reset this reader's internal state.
|
void |
setInput(java.lang.Object input)
Set the input source to the given object.
|
void |
setInput(java.lang.Object in,
boolean seekForwardOnly)
Set the input source to the given object and specify whether this
reader should be allowed to read input from the data stream more
than once.
|
void |
setInput(java.lang.Object input,
boolean seekForwardOnly,
boolean ignoreMetadata)
Set the input source to the given object, specify whether this
reader should be allowed to read input from the data stream more
than once, and specify whether this reader should ignore metadata
in the input stream.
|
void |
setLocale(java.util.Locale locale)
Set the current locale or use the default locale.
|
protected java.util.Locale[] availableLocales
protected boolean ignoreMetadata
protected java.lang.Object input
protected java.util.Locale locale
protected int minIndex
protected javax.imageio.spi.ImageReaderSpi originatingProvider
protected java.util.List<javax.imageio.event.IIOReadProgressListener> progressListeners
protected boolean seekForwardOnly
protected java.util.List<javax.imageio.event.IIOReadUpdateListener> updateListeners
protected java.util.List<javax.imageio.event.IIOReadWarningListener> warningListeners
protected java.util.List<java.util.Locale> warningLocales
protected ImageReader(javax.imageio.spi.ImageReaderSpi originatingProvider)
originatingProvider - the provider that is constructing this
image reader, or nullpublic void abort()
protected boolean abortRequested()
public void addIIOReadProgressListener(javax.imageio.event.IIOReadProgressListener listener)
listener - a read progress listener or nullpublic void addIIOReadUpdateListener(javax.imageio.event.IIOReadUpdateListener listener)
listener - a read update listenerpublic void addIIOReadWarningListener(javax.imageio.event.IIOReadWarningListener listener)
listener - a read warning listenerpublic boolean canReadRaster()
protected void clearAbortRequest()
public void dispose()
public float getAspectRatio(int imageIndex) throws java.io.IOException
imageIndex - the frame indexjava.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic java.util.Locale[] getAvailableLocales()
public ImageReadParam getDefaultReadParam()
public java.lang.String getFormatName() throws java.io.IOException
java.io.IOException - if a read error occurspublic abstract int getHeight(int imageIndex) throws java.io.IOException
imageIndex - the frame indexjava.lang.IllegalStateException - if input has not been setjava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic abstract javax.imageio.metadata.IIOMetadata getImageMetadata(int imageIndex) throws java.io.IOException
imageIndex - the frame indexjava.lang.IllegalStateException - if input has not been setjava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic abstract java.util.Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex) throws java.io.IOException
imageIndex - the frame indexjava.lang.IllegalStateException - if input has not been setjava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic void setInput(java.lang.Object input, boolean seekForwardOnly, boolean ignoreMetadata)
input - the input source objectseekForwardOnly - true if this reader should be allowed to
read input from the data stream more than once, false otherwiseignoreMetadata - true if this reader should ignore metadata
associated with the input source, false otherwisejava.lang.IllegalArgumentException - if input is not a valid input
source for this reader and is not an ImageInputStreampublic void setInput(java.lang.Object in, boolean seekForwardOnly)
in - the input source objectseekForwardOnly - true if this reader should be allowed to
read input from the data stream more than once, false otherwisejava.lang.IllegalArgumentException - if input is not a valid input
source for this reader and is not an ImageInputStreampublic void setInput(java.lang.Object input)
input - the input source objectjava.lang.IllegalArgumentException - if input is not a valid input
source for this reader and is not an ImageInputStreampublic java.lang.Object getInput()
public java.util.Locale getLocale()
public abstract int getNumImages(boolean allowSearch) throws java.io.IOException
allowSearch - true if all images should be available at
once, false otherwisejava.lang.IllegalStateException - if input has not been set, or if
seekForwardOnly is truejava.io.IOException - if a read error occurspublic int getNumThumbnails(int imageIndex) throws java.io.IOException
imageIndex - the frame indexjava.io.IOExceptionpublic javax.imageio.spi.ImageReaderSpi getOriginatingProvider()
public abstract javax.imageio.metadata.IIOMetadata getStreamMetadata() throws java.io.IOException
java.io.IOException - if a read error occurspublic int getThumbnailHeight(int imageIndex, int thumbnailIndex) throws java.io.IOException
imageIndex - the frame indexthumbnailIndex - the thumbnail indexjava.lang.UnsupportedOperationException - if this reader does not
support thumbnailsjava.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if either index is
out-of-boundsjava.io.IOException - if a read error occurspublic int getThumbnailWidth(int imageIndex, int thumbnailIndex) throws java.io.IOException
imageIndex - the frame indexthumbnailIndex - the thumbnail indexjava.lang.UnsupportedOperationException - if this reader does not
support thumbnailsjava.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if either index is
out-of-boundsjava.io.IOException - if a read error occurspublic int getTileGridXOffset(int imageIndex) throws java.io.IOException
imageIndex - the frame indexjava.lang.IllegalStateException - if input is needed but the input
source is not setjava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic int getTileGridYOffset(int imageIndex) throws java.io.IOException
imageIndex - the frame indexjava.lang.IllegalStateException - if input is needed but the input
source is not setjava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic int getTileHeight(int imageIndex) throws java.io.IOException
imageIndex - the frame indexjava.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic int getTileWidth(int imageIndex) throws java.io.IOException
imageIndex - the frame indexjava.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic abstract int getWidth(int imageIndex) throws java.io.IOException
imageIndex - the image's indexjava.lang.IllegalStateException - if input has not been setjava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic boolean hasThumbnails(int imageIndex) throws java.io.IOException
java.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic boolean isIgnoringMetadata()
public boolean isImageTiled(int imageIndex) throws java.io.IOException
java.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic boolean isRandomAccessEasy(int imageIndex) throws java.io.IOException
imageIndex - the frame indexjava.lang.IllegalStateException - if input is null and it is
needed to determine the return valuejava.lang.IndexOutOfBoundsException - if the frame index is
out-of-bounds but the frame data must be accessed to determine
the return valuejava.io.IOException - if a read error occurspublic boolean isSeekForwardOnly()
protected void processImageComplete()
protected void processImageProgress(float percentageDone)
percentageDone - the percentage of image data that has been
loadedprotected void processImageStarted(int imageIndex)
imageIndex - the frame index of the image that has started
loadingprotected void processImageUpdate(java.awt.image.BufferedImage image, int minX, int minY, int width, int height, int periodX, int periodY, int[] bands)
image - the buffered image that is being updatedminX - the X coordinate of the top-left pixel in this passminY - the Y coordinate of the top-left pixel in this passwidth - the total width of the rectangle covered by this
pass, including skipped pixelsheight - the total height of the rectangle covered by this
pass, including skipped pixelsperiodX - the horizontal sample intervalperiodY - the vertical sample intervalbands - the affected bands in the destinationprotected void processPassComplete(java.awt.image.BufferedImage image)
image - the image that has being updatedprotected void processPassStarted(java.awt.image.BufferedImage image, int pass, int minPass, int maxPass, int minX, int minY, int periodX, int periodY, int[] bands)
image - the buffered image that is being updatedpass - the current pass numberminPass - the pass at which decoding will beginmaxPass - the pass at which decoding will endminX - the X coordinate of the top-left pixel in this passminY - the Y coordinate of the top-left pixel in this passwidth - the total width of the rectangle covered by this
pass, including skipped pixelsheight - the total height of the rectangle covered by this
pass, including skipped pixelsperiodX - the horizontal sample intervalperiodY - the vertical sample intervalbands - the affected bands in the destinationprotected void processReadAborted()
protected void processSequenceComplete()
protected void processSequenceStarted(int minIndex)
minIndex - the index of the first image in the sequenceprotected void processThumbnailComplete()
protected void processThumbnailPassComplete(java.awt.image.BufferedImage thumbnail)
thumbnail - the thumbnail that has being updatedprotected void processThumbnailPassStarted(java.awt.image.BufferedImage thumbnail, int pass, int minPass, int maxPass, int minX, int minY, int periodX, int periodY, int[] bands)
thumbnail - the thumbnail that is being updatedpass - the current pass numberminPass - the pass at which decoding will beginmaxPass - the pass at which decoding will endminX - the X coordinate of the top-left pixel in this passminY - the Y coordinate of the top-left pixel in this passwidth - the total width of the rectangle covered by this
pass, including skipped pixelsheight - the total height of the rectangle covered by this
pass, including skipped pixelsperiodX - the horizontal sample intervalperiodY - the vertical sample intervalbands - the affected bands in the destinationprotected void processThumbnailProgress(float percentageDone)
percentageDone - the percentage of thumbnail data that has
been loadedprotected void processThumbnailStarted(int imageIndex, int thumbnailIndex)
imageIndex - the frame index of the image one of who's
thumbnails has started loadingthumbnailIndex - the index of the thumbnail that has started
loadingprotected void processThumbnailUpdate(java.awt.image.BufferedImage image, int minX, int minY, int width, int height, int periodX, int periodY, int[] bands)
image - the buffered image that is being updatedminX - the X coordinate of the top-left pixel in this passminY - the Y coordinate of the top-left pixel in this passwidth - the total width of the rectangle covered by this
pass, including skipped pixelsheight - the total height of the rectangle covered by this
pass, including skipped pixelsperiodX - the horizontal sample intervalperiodY - the vertical sample intervalbands - the affected bands in the destinationprotected void processWarningOccurred(java.lang.String warning)
warning - the warning messagejava.lang.IllegalArgumentException - if warning is nullprotected void processWarningOccurred(java.lang.String baseName, java.lang.String keyword)
baseName - the basename of the resource from which to
retrieve the warning messagekeyword - the keyword used to retrieve the warning from the
resource bundlejava.lang.IllegalArgumentException - if either baseName or keyword
is nulljava.lang.IllegalArgumentException - if no resource bundle is
found using baseNamejava.lang.IllegalArgumentException - if the given keyword produces
no results from the resource bundlejava.lang.IllegalArgumentException - if the retrieved object is
not a Stringpublic abstract java.awt.image.BufferedImage read(int imageIndex, ImageReadParam param) throws java.io.IOException
imageIndex - the index of the frame to readparam - the image read parameters to use when readingjava.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic boolean readerSupportsThumbnails()
public java.awt.image.Raster readRaster(int imageIndex, ImageReadParam param) throws java.io.IOException
imageIndex - the frame indexparam - the image read parametersjava.lang.UnsupportedOperationException - if this reader doesn't
support rastersjava.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic java.awt.image.BufferedImage readThumbnail(int imageIndex, int thumbnailIndex) throws java.io.IOException
imageIndex - the frame indexthumbnailIndex - the thumbnail indexjava.lang.UnsupportedOperationException - if this reader doesn't
support thumbnailsjava.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if either the frame index or
the thumbnail index is out-of-boundsjava.io.IOException - if a read error occurspublic void removeAllIIOReadProgressListeners()
public void removeAllIIOReadUpdateListeners()
public void removeAllIIOReadWarningListeners()
public void removeIIOReadProgressListener(javax.imageio.event.IIOReadProgressListener listener)
listener - the listener to removepublic void removeIIOReadUpdateListener(javax.imageio.event.IIOReadUpdateListener listener)
listener - the listener to removepublic void removeIIOReadWarningListener(javax.imageio.event.IIOReadWarningListener listener)
listener - the listener to removepublic void setLocale(java.util.Locale locale)
locale - the locale to set, or nullprotected static void checkReadParamBandSettings(ImageReadParam param, int numSrcBands, int numDstBands)
param - the image parameters to checknumSrcBands - the number of input source bandsnumDstBands - the number of ouput destination bandsjava.lang.IllegalArgumentException - if either the given source or
destination band indices are invalidprotected static void computeRegions(ImageReadParam param, int srcWidth, int srcHeight, java.awt.image.BufferedImage image, java.awt.Rectangle srcRegion, java.awt.Rectangle destRegion)
param - read parameters, or nullsrcWidth - the width of the source imagesrcHeight - the height of the source imageimage - the destination image, or nullsrcRegion - a rectangle whose values will be set to the
clipped source regiondestRegion - a rectangle whose values will be set to the
clipped destination regionjava.lang.IllegalArgumentException - if either srcRegion or
destRegion is nulljava.lang.IllegalArgumentException - if either of the calculated
regions is emptyprotected static java.awt.image.BufferedImage getDestination(ImageReadParam param, java.util.Iterator<ImageTypeSpecifier> imageTypes, int width, int height) throws IIOException
param - image read parameters from which a destination image
or image type is retrieved, or nullimageTypes - a collection of legal image typeswidth - the width of the source imageheight - the height of the source imageIIOException - if param.getDestinationType() does not
return an image type in imageTypesjava.lang.IllegalArgumentException - if imageTypes is null or
empty, or if a non-ImageTypeSpecifier object is retrieved from
imageTypesjava.lang.IllegalArgumentException - if the resulting destination
region is emptyjava.lang.IllegalArgumentException - if the product of width and
height is greater than Integer.MAX_VALUEpublic javax.imageio.metadata.IIOMetadata getImageMetadata(int imageIndex, java.lang.String formatName, java.util.Set<java.lang.String> nodeNames) throws java.io.IOException
imageIndex - the frame indexformatName - the format of metadata requestednodeNames - a set of Strings specifiying node names to be
retrievedjava.lang.IllegalStateException - if input has not been setjava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.lang.IllegalArgumentException - if formatName is nulljava.lang.IllegalArgumentException - if nodeNames is nulljava.io.IOException - if a read error occurspublic int getMinIndex()
public ImageTypeSpecifier getRawImageType(int imageIndex) throws java.io.IOException
imageIndex - the frame indexjava.lang.IllegalStateException - if input has not been setjava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occursprotected static java.awt.Rectangle getSourceRegion(ImageReadParam param, int srcWidth, int srcHeight)
param - image parameters, or nullsrcWidth - the width of the source imagesrcHeight - the height of the source imagepublic javax.imageio.metadata.IIOMetadata getStreamMetadata(java.lang.String formatName, java.util.Set<java.lang.String> nodeNames) throws java.io.IOException
formatName - the format of metadata requestednodeNames - a set of Strings specifiying node names to be
retrievedjava.lang.IllegalArgumentException - if formatName is nulljava.lang.IllegalArgumentException - if nodeNames is nulljava.io.IOException - if a read error occurspublic java.awt.image.BufferedImage read(int imageIndex) throws java.io.IOException
imageIndex - the index of the image frame to readjava.lang.IllegalStateException - if input has not been setjava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.io.IOException - if a read error occurspublic IIOImage readAll(int imageIndex, ImageReadParam param) throws java.io.IOException
imageIndex - the index of the image frame to readparam - the image read parametersjava.lang.IllegalStateException - if input has not been setjava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.lang.IllegalArgumentException - if param.getSourceBands() and
param.getDestinationBands() are incompatiblejava.lang.IllegalArgumentException - if either the source or
destination image regions are emptyjava.io.IOException - if a read error occurspublic java.util.Iterator<IIOImage> readAll(java.util.Iterator<? extends ImageReadParam> params) throws java.io.IOException
params - iterator over the image read parametersjava.lang.IllegalStateException - if input has not been setjava.lang.IllegalArgumentException - if a non-ImageReadParam is
found in paramsjava.lang.IllegalArgumentException - if param.getSourceBands() and
param.getDestinationBands() are incompatiblejava.lang.IllegalArgumentException - if either the source or
destination image regions are emptyjava.io.IOException - if a read error occurspublic java.awt.image.RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param) throws java.io.IOException
imageIndex - the index of the image frame to readparam - the image read parametersjava.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.lang.IllegalArgumentException - if param.getSourceBands() and
param.getDestinationBands() are incompatiblejava.lang.IllegalArgumentException - if either the source or
destination image regions are emptyjava.io.IOException - if a read error occurspublic java.awt.image.BufferedImage readTile(int imageIndex, int tileX, int tileY) throws java.io.IOException
imageIndex - the frame indextileX - the horizontal tile coordinatetileY - the vertical tile coordinatejava.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.lang.IllegalArgumentException - if the tile coordinates are
out-of-boundsjava.io.IOException - if a read error occurspublic java.awt.image.Raster readTileRaster(int imageIndex, int tileX, int tileY) throws java.io.IOException
imageIndex - the frame indextileX - the horizontal tile coordinatetileY - the vertical tile coordinatejava.lang.UnsupportedOperationException - if rasters are not
supportedjava.lang.IllegalStateException - if input is nulljava.lang.IndexOutOfBoundsException - if the frame index is
out-of-boundsjava.lang.IllegalArgumentException - if the tile coordinates are
out-of-boundsjava.io.IOException - if a read error occurspublic void reset()