Class BufferedImageCacheEntry
- java.lang.Object
-
- org.openstreetmap.josm.data.cache.CacheEntry
-
- org.openstreetmap.josm.data.cache.BufferedImageCacheEntry
-
- All Implemented Interfaces:
java.io.Serializable
public class BufferedImageCacheEntry extends CacheEntry
Cache Entry that has methods to get the BufferedImage, that will be cached along in memory but will be not serialized when saved to the disk (to avoid duplication of data)- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
imageLoaded
private java.awt.image.BufferedImage
img
private static long
serialVersionUID
-
Fields inherited from class org.openstreetmap.josm.data.cache.CacheEntry
content
-
-
Constructor Summary
Constructors Constructor Description BufferedImageCacheEntry(byte[] content)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.BufferedImage
getImage()
Returns BufferedImage from for the content.static BufferedImageCacheEntry
pngEncoded(java.awt.image.BufferedImage img)
Encodes the given image as PNG and returns a cache entryprivate void
writeObject(java.io.ObjectOutputStream out)
-
Methods inherited from class org.openstreetmap.josm.data.cache.CacheEntry
getContent
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
img
private transient volatile java.awt.image.BufferedImage img
-
imageLoaded
private transient volatile boolean imageLoaded
-
-
Constructor Detail
-
BufferedImageCacheEntry
public BufferedImageCacheEntry(byte[] content)
- Parameters:
content
- byte array containing image
-
-
Method Detail
-
pngEncoded
public static BufferedImageCacheEntry pngEncoded(java.awt.image.BufferedImage img)
Encodes the given image as PNG and returns a cache entry- Parameters:
img
- the image- Returns:
- a cache entry for the PNG encoded image
- Throws:
java.io.UncheckedIOException
- if an I/O error occurs
-
getImage
public java.awt.image.BufferedImage getImage() throws java.io.IOException
Returns BufferedImage from for the content. Subsequent calls will return the same instance, to reduce overhead of ImageIO- Returns:
- BufferedImage of cache entry content
- Throws:
java.io.IOException
- if an error occurs during reading.
-
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
-