Groovy Documentation

org.jdesktop.swingx.mapviewer
[Java] Class TileCache

java.lang.Object
  org.jdesktop.swingx.mapviewer.TileCache

public class TileCache
extends Object

An implementation only class for now. For internal use only.

Authors:
joshua.marinacci@sun.com


Field Summary
private Map bytemap

private LinkedList bytemapAccessQueue

private int bytesize

private int imagesize

private Map imgmap

private LinkedList imgmapAccessQueue

 
Constructor Summary
TileCache()

 
Method Summary
private void addToImageCache(URI uri, BufferedImage img)

BufferedImage get(URI uri)

Returns a buffered image for the requested URI from the cache.

void needMoreMemory()

Request that the cache free up some memory.

private void p(String string)

void put(URI uri, byte[] bimg, BufferedImage img)

Put a tile image into the cache.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

bytemap

private Map bytemap


bytemapAccessQueue

private LinkedList bytemapAccessQueue


bytesize

private int bytesize


imagesize

private int imagesize


imgmap

private Map imgmap


imgmapAccessQueue

private LinkedList imgmapAccessQueue


 
Constructor Detail

TileCache

public TileCache()


 
Method Detail

addToImageCache

private void addToImageCache(URI uri, BufferedImage img)


get

public BufferedImage get(URI uri)
Returns a buffered image for the requested URI from the cache. This method must return null if the image is not in the cache. If the image is unavailable but it's compressed version *is* available, then the compressed version will be expanded and returned.
throws:
java.io.IOException
Parameters:
uri - URI of the image previously put in the cache
Returns:
the image matching the requested URI, or null if not available


needMoreMemory

public void needMoreMemory()
Request that the cache free up some memory. How this happens or how much memory is freed is up to the TileCache implementation. Subclasses can implement their own strategy. The default strategy is to clear out all buffered images but retain the compressed versions.


p

private void p(String string)


put

public void put(URI uri, byte[] bimg, BufferedImage img)
Put a tile image into the cache. This puts both a buffered image and array of bytes that make up the compressed image.
Parameters:
uri - URI of image that is being stored in the cache
bimg - bytes of the compressed image, ie: the image file that was loaded over the network
img - image to store in the cache


 

Groovy Documentation