
public class TileWriter extends Object implements IFilesystemCache
IFilesystemCache. It writes tiles to the file system cache. If the
cache exceeds 600 Mb then it will be trimmed to 500 Mb.OpenStreetMapTileProviderConstants| Modifier and Type | Field and Description |
|---|---|
(package private) static boolean |
hasInited |
(package private) Thread |
initThread |
| Constructor and Description |
|---|
TileWriter() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
exists(ITileSource pTileSource,
long pMapTileIndex)
return true if the map file for download already exists
|
Long |
getExpirationTimestamp(ITileSource pTileSource,
long pMapTileIndex)
Gets the cache expiration timestamp of a tile
|
File |
getFile(ITileSource pTileSource,
long pMapTileIndex) |
static long |
getUsedCacheSpace()
Get the amount of disk space used by the tile cache.
|
Drawable |
loadTile(ITileSource pTileSource,
long pMapTileIndex)
Gets the tile drawable
|
void |
onDetach()
Used when the map engine is shutdown, use it to perform any clean up activities and to terminate
any background threads
|
boolean |
remove(ITileSource pTileSource,
long pMapTileIndex)
Removes a tile from the cache, see issue
https://github.com/osmdroid/osmdroid/issues/426
|
boolean |
saveFile(ITileSource pTileSource,
long pMapTileIndex,
InputStream pStream,
Long pExpirationTime)
Save an InputStream as the specified tile in the file system cache for the specified tile
source.
|
void |
setMaximumCachedFileAge(long mMaximumCachedFileAge) |
static boolean hasInited
Thread initThread
public static long getUsedCacheSpace()
public void setMaximumCachedFileAge(long mMaximumCachedFileAge)
public boolean saveFile(ITileSource pTileSource, long pMapTileIndex, InputStream pStream, Long pExpirationTime)
IFilesystemCachesaveFile in interface IFilesystemCachepTileSource - a tile sourcepMapTileIndex - a tilepStream - an InputStreampublic void onDetach()
IFilesystemCacheonDetach in interface IFilesystemCachepublic boolean remove(ITileSource pTileSource, long pMapTileIndex)
IFilesystemCacheremove in interface IFilesystemCachepublic File getFile(ITileSource pTileSource, long pMapTileIndex)
public boolean exists(ITileSource pTileSource, long pMapTileIndex)
IFilesystemCacheexists in interface IFilesystemCachepublic Long getExpirationTimestamp(ITileSource pTileSource, long pMapTileIndex)
IFilesystemCachegetExpirationTimestamp in interface IFilesystemCachepublic Drawable loadTile(ITileSource pTileSource, long pMapTileIndex) throws Exception
IFilesystemCacheloadTile in interface IFilesystemCacheException