Class IIOImage
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 Summary
FieldsModifier and TypeFieldDescriptionprotected RenderedImage
TheRenderedImage
being referenced.protected IIOMetadata
AnIIOMetadata
object containing metadata associated with the image.protected Raster
TheRaster
being referenced.protected List
<? extends BufferedImage> AList
ofBufferedImage
thumbnails, ornull
. -
Constructor Summary
ConstructorsConstructorDescriptionIIOImage
(Raster raster, List<? extends BufferedImage> thumbnails, IIOMetadata metadata) Constructs anIIOImage
containing aRaster
, and thumbnails and metadata associated with it.IIOImage
(RenderedImage image, List<? extends BufferedImage> thumbnails, IIOMetadata metadata) Constructs anIIOImage
containing aRenderedImage
, and thumbnails and metadata associated with it. -
Method Summary
Modifier and TypeMethodDescriptionReturns a reference to the currentIIOMetadata
object, ornull
is none is set.int
Returns the number of thumbnails stored in thisIIOImage
.Returns the currently setRaster
, ornull
if only aRenderedImage
is available.Returns the currently setRenderedImage
, ornull
if only aRaster
is available.getThumbnail
(int index) Returns a thumbnail associated with the main image.List
<? extends BufferedImage> Returns the currentList
of thumbnailBufferedImage
s, ornull
if none is set.boolean
Returnstrue
if thisIIOImage
stores aRaster
rather than aRenderedImage
.void
setMetadata
(IIOMetadata metadata) Sets theIIOMetadata
to a new object, ornull
.void
Sets the currentRaster
.void
setRenderedImage
(RenderedImage image) Sets the currentRenderedImage
.void
setThumbnails
(List<? extends BufferedImage> thumbnails) Sets the list of thumbnails to a newList
ofBufferedImage
s, or tonull
.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class
<?> getClass()
Returns the runtime class of thisObject
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.toString()
Returns a string representation of the object.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final void
wait
(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Field Details
-
image
TheRenderedImage
being referenced. -
raster
TheRaster
being referenced. -
thumbnails
AList
ofBufferedImage
thumbnails, ornull
. Non-BufferedImage
objects must not be stored in thisList
. -
metadata
AnIIOMetadata
object containing metadata associated with the image.
-
-
Constructor Details
-
IIOImage
public IIOImage(RenderedImage image, List<? extends BufferedImage> thumbnails, IIOMetadata metadata) Constructs anIIOImage
containing aRenderedImage
, and thumbnails and metadata associated with it.All parameters are stored by reference.
The
thumbnails
argument must either benull
or contain onlyBufferedImage
objects.- Parameters:
image
- aRenderedImage
.thumbnails
- aList
ofBufferedImage
s, ornull
.metadata
- anIIOMetadata
object, ornull
.- Throws:
IllegalArgumentException
- ifimage
isnull
.
-
IIOImage
Constructs anIIOImage
containing aRaster
, and thumbnails and metadata associated with it.All parameters are stored by reference.
- Parameters:
raster
- aRaster
.thumbnails
- aList
ofBufferedImage
s, ornull
.metadata
- anIIOMetadata
object, ornull
.- Throws:
IllegalArgumentException
- ifraster
isnull
.
-
-
Method Details
-
getRenderedImage
Returns the currently setRenderedImage
, ornull
if only aRaster
is available.- Returns:
- a
RenderedImage
, ornull
. - See Also:
-
setRenderedImage
Sets the currentRenderedImage
. The value is stored by reference. Any existingRaster
is discarded.- Parameters:
image
- aRenderedImage
.- Throws:
IllegalArgumentException
- ifimage
isnull
.- See Also:
-
hasRaster
public boolean hasRaster()Returnstrue
if thisIIOImage
stores aRaster
rather than aRenderedImage
.- Returns:
true
if aRaster
is available.
-
getRaster
Returns the currently setRaster
, ornull
if only aRenderedImage
is available.- Returns:
- a
Raster
, ornull
. - See Also:
-
setRaster
Sets the currentRaster
. The value is stored by reference. Any existingRenderedImage
is discarded.- Parameters:
raster
- aRaster
.- Throws:
IllegalArgumentException
- ifraster
isnull
.- See Also:
-
getNumThumbnails
public int getNumThumbnails()Returns the number of thumbnails stored in thisIIOImage
.- Returns:
- the number of thumbnails, as an
int
.
-
getThumbnail
Returns 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-BufferedImage
object is encountered in the list of thumbnails at the given index.- See Also:
-
getThumbnails
Returns the currentList
of thumbnailBufferedImage
s, ornull
if none is set. A live reference is returned.- Returns:
- the current
List
ofBufferedImage
thumbnails, ornull
. - See Also:
-
setThumbnails
Sets the list of thumbnails to a newList
ofBufferedImage
s, or tonull
. The reference to the previousList
is discarded.The
thumbnails
argument must either benull
or contain onlyBufferedImage
objects.- Parameters:
thumbnails
- aList
ofBufferedImage
thumbnails, ornull
.- See Also:
-
getMetadata
Returns a reference to the currentIIOMetadata
object, ornull
is none is set.- Returns:
- an
IIOMetadata
object, ornull
. - See Also:
-
setMetadata
Sets theIIOMetadata
to a new object, ornull
.- Parameters:
metadata
- anIIOMetadata
object, ornull
.- See Also:
-