APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.awt.image

public final Class ImageCache

extends Object
Class Inheritance
Imports
java.awt.*, java.lang.ref.*, java.util.*, java.util.concurrent.locks.*

ImageCache - A fixed pixel count sized cache of Images keyed by arbitrary set of arguments. All images are held with SoftReferences so they will be dropped by the GC if heap memory gets tight. When our size hits max pixel count least recently requested images are removed first.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static interface

Field Summary

Modifier and TypeField and Description
private int
private static final ImageCache
private final ReadWriteLock
private final LinkedHashMap<ImageCache.PixelsKey, ImageCache.ImageSoftReference>
private final int
private final ReferenceQueue<Image>

Constructor Summary

AccessConstructor and Description
pack-priv
ImageCache(final int maxPixelCount)

pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public Image
public static ImageCache
public void
setImage(final ImageCache.PixelsKey
The key with which the specified image is to be associated
key
,
final Image
The image to store in cache
image
)

Sets the cached image for the specified constraints.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentPixelCountback to summary
private int currentPixelCount
instanceback to summary
private static final ImageCache instance
lockback to summary
private final ReadWriteLock lock
mapback to summary
private final LinkedHashMap<ImageCache.PixelsKey, ImageCache.ImageSoftReference> map
maxPixelCountback to summary
private final int maxPixelCount
referenceQueueback to summary
private final ReferenceQueue<Image> referenceQueue

Constructor Detail

ImageCacheback to summary
pack-priv ImageCache(final int maxPixelCount)
ImageCacheback to summary
pack-priv ImageCache()

Method Detail

flushback to summary
public void flush()
getImageback to summary
public Image getImage(final ImageCache.PixelsKey key)
getInstanceback to summary
public static ImageCache getInstance()
setImageback to summary
public void setImage(final ImageCache.PixelsKey key, final Image image)

Sets the cached image for the specified constraints.

Parameters
key:ImageCache.PixelsKey

The key with which the specified image is to be associated

image:Image

The image to store in cache

sun.awt.image back to summary

private Class ImageCache.ImageSoftReference

extends SoftReference<Image>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final ImageCache.PixelsKey

Constructor Summary

AccessConstructor and Description
pack-priv
ImageSoftReference(final ImageCache.PixelsKey key, final Image referent, final ReferenceQueue<? super Image> q)

Method Summary

Inherited from java.lang.ref.SoftReference:
get

Field Detail

keyback to summary
pack-priv final ImageCache.PixelsKey key

Constructor Detail

ImageSoftReferenceback to summary
pack-priv ImageSoftReference(final ImageCache.PixelsKey key, final Image referent, final ReferenceQueue<? super Image> q)
sun.awt.image back to summary

public Interface ImageCache.PixelsKey

Known Direct Implementers
sun.awt.image.MultiResolutionCachedImage.ImageCacheKey

Method Summary

Modifier and TypeMethod and Description
public int

Method Detail

getPixelCountback to summary
public int getPixelCount()