Package nl.bebr.mapviewer.data.cache
Class OfflineTileRunner<T>
- java.lang.Object
-
- nl.bebr.mapviewer.data.cache.OfflineTileRunner<T>
-
- All Implemented Interfaces:
Runnable
public abstract class OfflineTileRunner<T> extends Object implements Runnable
Runner does the loading.First we check memory cache. If failed, disk cache is searched.
If also unsuccessful and online, download tile from openstreetmap server
Otherwise create offline Tile
- Author:
- Frantisek Post
-
-
Constructor Summary
Constructors Constructor Description OfflineTileRunner(OfflineTileFactory<T> tileFactory)Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected byte[]cacheInputStream(URL url)abstract TileRepository<T>getTileRepository()Method to get specificTileRepositoryprotected URIgetURI(Tile<T> tile)abstract TloadImage(URI uri)Method to load image from givenURIprotected abstract TreadTileFromRepository(TileCacheInfo info)voidrun()voidstop()
-
-
-
Constructor Detail
-
OfflineTileRunner
public OfflineTileRunner(OfflineTileFactory<T> tileFactory)
Constructor- Parameters:
tileFactory-
-
-
Method Detail
-
getURI
protected URI getURI(Tile<T> tile) throws URISyntaxException
- Throws:
URISyntaxException
-
readTileFromRepository
protected abstract T readTileFromRepository(TileCacheInfo info)
-
cacheInputStream
protected byte[] cacheInputStream(URL url) throws IOException
- Throws:
IOException
-
loadImage
public abstract T loadImage(URI uri) throws MalformedURLException, IOException
Method to load image from givenURI- Parameters:
uri- tile uri- Returns:
- image
- Throws:
MalformedURLExceptionIOException
-
getTileRepository
public abstract TileRepository<T> getTileRepository()
Method to get specificTileRepository- Returns:
-
stop
public void stop()
-
-