java.lang.Object
javax.imageio.IIOImage
A simple container class to aggregate an image, a set of
 thumbnail (preview) images, and an object representing metadata
 associated with the image.
 
 The image data may take the form of either a
 RenderedImage, or a Raster.  Reader
 methods that return an IIOImage will always return a
 BufferedImage using the RenderedImage
 reference.  Writer methods that accept an IIOImage
 will always accept a RenderedImage, and may optionally
 accept a Raster.
 
 Exactly one of getRenderedImage and
 getRaster will return a non-null value.
 Subclasses are responsible for ensuring this behavior.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected RenderedImageTheRenderedImagebeing referenced.protected IIOMetadataAnIIOMetadataobject containing metadata associated with the image.protected RasterTheRasterbeing referenced.protected List<? extends BufferedImage> AListofBufferedImagethumbnails, ornull.
- 
Constructor SummaryConstructorsConstructorDescriptionIIOImage(Raster raster, List<? extends BufferedImage> thumbnails, IIOMetadata metadata) Constructs anIIOImagecontaining aRaster, and thumbnails and metadata associated with it.IIOImage(RenderedImage image, List<? extends BufferedImage> thumbnails, IIOMetadata metadata) Constructs anIIOImagecontaining aRenderedImage, and thumbnails and metadata associated with it.
- 
Method SummaryModifier and TypeMethodDescriptionReturns a reference to the currentIIOMetadataobject, ornullis none is set.intReturns the number of thumbnails stored in thisIIOImage.Returns the currently setRaster, ornullif only aRenderedImageis available.Returns the currently setRenderedImage, ornullif only aRasteris available.getThumbnail(int index) Returns a thumbnail associated with the main image.List<? extends BufferedImage> Returns the currentListof thumbnailBufferedImages, ornullif none is set.booleanReturnstrueif thisIIOImagestores aRasterrather than aRenderedImage.voidsetMetadata(IIOMetadata metadata) Sets theIIOMetadatato a new object, ornull.voidSets the currentRaster.voidsetRenderedImage(RenderedImage image) Sets the currentRenderedImage.voidsetThumbnails(List<? extends BufferedImage> thumbnails) Sets the list of thumbnails to a newListofBufferedImages, or tonull.
- 
Field Details- 
imageTheRenderedImagebeing referenced.
- 
rasterTheRasterbeing referenced.
- 
thumbnailsAListofBufferedImagethumbnails, ornull. Non-BufferedImageobjects must not be stored in thisList.
- 
metadataAnIIOMetadataobject containing metadata associated with the image.
 
- 
- 
Constructor Details- 
IIOImagepublic IIOImage(RenderedImage image, List<? extends BufferedImage> thumbnails, IIOMetadata metadata) Constructs anIIOImagecontaining aRenderedImage, and thumbnails and metadata associated with it.All parameters are stored by reference. The thumbnailsargument must either benullor contain onlyBufferedImageobjects.- Parameters:
- image- a- RenderedImage.
- thumbnails- a- Listof- BufferedImages, or- null.
- metadata- an- IIOMetadataobject, or- null.
- Throws:
- IllegalArgumentException- if- imageis- null.
 
- 
IIOImageConstructs anIIOImagecontaining aRaster, and thumbnails and metadata associated with it.All parameters are stored by reference. - Parameters:
- raster- a- Raster.
- thumbnails- a- Listof- BufferedImages, or- null.
- metadata- an- IIOMetadataobject, or- null.
- Throws:
- IllegalArgumentException- if- rasteris- null.
 
 
- 
- 
Method Details- 
getRenderedImageReturns the currently setRenderedImage, ornullif only aRasteris available.- Returns:
- a RenderedImage, ornull.
- See Also:
 
- 
setRenderedImageSets the currentRenderedImage. The value is stored by reference. Any existingRasteris discarded.- Parameters:
- image- a- RenderedImage.
- Throws:
- IllegalArgumentException- if- imageis- null.
- See Also:
 
- 
hasRasterpublic boolean hasRaster()Returnstrueif thisIIOImagestores aRasterrather than aRenderedImage.- Returns:
- trueif a- Rasteris available.
 
- 
getRasterReturns the currently setRaster, ornullif only aRenderedImageis available.- Returns:
- a Raster, ornull.
- See Also:
 
- 
setRasterSets the currentRaster. The value is stored by reference. Any existingRenderedImageis discarded.- Parameters:
- raster- a- Raster.
- Throws:
- IllegalArgumentException- if- rasteris- null.
- See Also:
 
- 
getNumThumbnailspublic int getNumThumbnails()Returns the number of thumbnails stored in thisIIOImage.- Returns:
- the number of thumbnails, as an int.
 
- 
getThumbnailReturns a thumbnail associated with the main image.- Parameters:
- index- the index of the desired thumbnail image.
- Returns:
- a thumbnail image, as a BufferedImage.
- Throws:
- IndexOutOfBoundsException- if the supplied index is negative or larger than the largest valid index.
- ClassCastException- if a non-- BufferedImageobject is encountered in the list of thumbnails at the given index.
- See Also:
 
- 
getThumbnailsReturns the currentListof thumbnailBufferedImages, ornullif none is set. A live reference is returned.- Returns:
- the current ListofBufferedImagethumbnails, ornull.
- See Also:
 
- 
setThumbnailsSets the list of thumbnails to a newListofBufferedImages, or tonull. The reference to the previousListis discarded.The thumbnailsargument must either benullor contain onlyBufferedImageobjects.- Parameters:
- thumbnails- a- Listof- BufferedImagethumbnails, or- null.
- See Also:
 
- 
getMetadataReturns a reference to the currentIIOMetadataobject, ornullis none is set.- Returns:
- an IIOMetadataobject, ornull.
- See Also:
 
- 
setMetadataSets theIIOMetadatato a new object, ornull.- Parameters:
- metadata- an- IIOMetadataobject, or- null.
- See Also:
 
 
-