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)
IFilesystemCache
saveFile
in interface IFilesystemCache
pTileSource
- a tile sourcepMapTileIndex
- a tilepStream
- an InputStreampublic void onDetach()
IFilesystemCache
onDetach
in interface IFilesystemCache
public boolean remove(ITileSource pTileSource, long pMapTileIndex)
IFilesystemCache
remove
in interface IFilesystemCache
public File getFile(ITileSource pTileSource, long pMapTileIndex)
public boolean exists(ITileSource pTileSource, long pMapTileIndex)
IFilesystemCache
exists
in interface IFilesystemCache
public Long getExpirationTimestamp(ITileSource pTileSource, long pMapTileIndex)
IFilesystemCache
getExpirationTimestamp
in interface IFilesystemCache
public Drawable loadTile(ITileSource pTileSource, long pMapTileIndex) throws Exception
IFilesystemCache
loadTile
in interface IFilesystemCache
Exception