Class 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  
    • 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 entry
      private void writeObject​(java.io.ObjectOutputStream out)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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