Class CachedImageLoader

  • All Implemented Interfaces:
    ImageLoader

    public class CachedImageLoader
    extends Object
    implements ImageLoader
    The CachedImageLoader is a simple ImageLoader that uses your disk as a cache for tiles. You can plug this implementation into a Tile object. Note that the TileService also has a cache of its own, but for caching tiles, not necessarily their images.

    Image loading is an important performance factor to tile clients. Tests have shown that image loading is more important than image rendering. The risk is, however, to fill your disk with tile images, so make sure to empty the directory from time to time. Also note that some tile service may not allow you to save tile locally. If you do so, you might be breaching licenses. So, be nice.

    Since:
    12
    Author:
    Ugo Taddei
    • Constructor Summary

      Constructors 
      Constructor Description
      CachedImageLoader​(File cacheDirectory)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      BufferedImage loadImageTileImage​(Tile tile)
      Loads an image for the given tile.
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CachedImageLoader

        public CachedImageLoader​(File cacheDirectory)
    • Method Detail

      • loadImageTileImage

        public BufferedImage loadImageTileImage​(Tile tile)
                                         throws IOException
        Description copied from interface: ImageLoader
        Loads an image for the given tile.
        Specified by:
        loadImageTileImage in interface ImageLoader
        Returns:
        an image
        Throws:
        IOException