-
- All Implemented Interfaces:
-
org.osmdroid.tileprovider.modules.IFilesystemCache
public class TileWriter implements IFilesystemCache
An implementation of IFilesystemCache. It writes tiles to the file system cache. If the cache exceeds 600 Mb then it will be trimmed to 500 Mb.
-
-
Constructor Summary
Constructors Constructor Description TileWriter()
-
Method Summary
Modifier and Type Method Description static longgetUsedCacheSpace()Get the amount of disk space used by the tile cache. voidsetMaximumCachedFileAge(long mMaximumCachedFileAge)booleansaveFile(ITileSource pTileSource, long pMapTileIndex, InputStream pStream, Long pExpirationTime)Save an InputStream as the specified tile in the file system cache for the specified tilesource. voidonDetach()Used when the map engine is shutdown, use it to perform any clean up activities and to terminateany background threads booleanremove(ITileSource pTileSource, long pMapTileIndex)Removes a tile from the cache, see issuehttps://github. FilegetFile(ITileSource pTileSource, long pMapTileIndex)booleanexists(ITileSource pTileSource, long pMapTileIndex)return true if the map file for download already exists LonggetExpirationTimestamp(ITileSource pTileSource, long pMapTileIndex)Gets the cache expiration timestamp of a tile DrawableloadTile(ITileSource pTileSource, long pMapTileIndex)Gets the tile drawable -
-
Method Detail
-
getUsedCacheSpace
static long getUsedCacheSpace()
Get the amount of disk space used by the tile cache. This will initially be zero since theused space is calculated in the background.
-
setMaximumCachedFileAge
void setMaximumCachedFileAge(long mMaximumCachedFileAge)
-
saveFile
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 tilesource.
- Parameters:
pMapTileIndex- a tilepStream- an InputStream
-
onDetach
void onDetach()
Used when the map engine is shutdown, use it to perform any clean up activities and to terminateany background threads
-
remove
boolean remove(ITileSource pTileSource, long pMapTileIndex)
Removes a tile from the cache, see issuehttps://github.com/osmdroid/osmdroid/issues/426
-
getFile
File getFile(ITileSource pTileSource, long pMapTileIndex)
-
exists
boolean exists(ITileSource pTileSource, long pMapTileIndex)
return true if the map file for download already exists
-
getExpirationTimestamp
Long getExpirationTimestamp(ITileSource pTileSource, long pMapTileIndex)
Gets the cache expiration timestamp of a tile
-
loadTile
Drawable loadTile(ITileSource pTileSource, long pMapTileIndex)
Gets the tile drawable
-
-
-
-