
public class SqliteArchiveTileWriter extends Object implements IFilesystemCache
IFilesystemCache based on the original TileWriter. It writes tiles to a sqlite database.
It does NOT support expiration and provides more of a MOBAC like functionality (non-expiring file archives).
Uses the same schema as MOBAC osm sqlite and the DatabaseFileArchive
https://github.com/osmdroid/osmdroid/issues/348
SqlTileWriter,
DatabaseFileArchive| Modifier and Type | Field and Description |
|---|---|
(package private) File |
db_file |
(package private) static boolean |
hasInited |
(package private) SQLiteDatabase |
mDatabase |
(package private) int |
questimate |
| Constructor and Description |
|---|
SqliteArchiveTileWriter(String outputFile) |
| 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
|
Cursor |
getTileCursor(String[] pPrimaryKeyParameters) |
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 tileSource,
long pMapTileIndex)
Removes a tile from the cache, see issue
https://github.com/osmdroid/osmdroid/issues/426
|
boolean |
saveFile(ITileSource pTileSourceInfo,
long pMapTileIndex,
InputStream pStream,
Long pExpirationTime)
Save an InputStream as the specified tile in the file system cache for the specified tile
source.
|
final File db_file
final SQLiteDatabase mDatabase
final int questimate
static boolean hasInited
public boolean saveFile(ITileSource pTileSourceInfo, long pMapTileIndex, InputStream pStream, Long pExpirationTime)
IFilesystemCachesaveFile in interface IFilesystemCachepTileSourceInfo - a tile sourcepMapTileIndex - a tilepStream - an InputStreampublic boolean exists(ITileSource pTileSource, long pMapTileIndex)
IFilesystemCacheexists in interface IFilesystemCachepublic void onDetach()
IFilesystemCacheonDetach in interface IFilesystemCachepublic boolean remove(ITileSource tileSource, long pMapTileIndex)
IFilesystemCacheremove in interface IFilesystemCachepublic Long getExpirationTimestamp(ITileSource pTileSource, long pMapTileIndex)
IFilesystemCachegetExpirationTimestamp in interface IFilesystemCachepublic Cursor getTileCursor(String[] pPrimaryKeyParameters)
pPrimaryKeyParameters - public Drawable loadTile(ITileSource pTileSource, long pMapTileIndex) throws Exception
IFilesystemCacheloadTile in interface IFilesystemCacheException