Package 

Class TileWriter

  • 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 long getUsedCacheSpace() Get the amount of disk space used by the tile cache.
      void setMaximumCachedFileAge(long mMaximumCachedFileAge)
      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.
      void onDetach() Used when the map engine is shutdown, use it to perform any clean up activities and to terminateany background threads
      boolean remove(ITileSource pTileSource, long pMapTileIndex) Removes a tile from the cache, see issuehttps://github.
      File getFile(ITileSource pTileSource, long pMapTileIndex)
      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
      Drawable loadTile(ITileSource pTileSource, long pMapTileIndex) Gets the tile drawable
      • Methods inherited from class org.osmdroid.tileprovider.modules.IFilesystemCache

        exists, remove, saveFile
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TileWriter

        TileWriter()
    • 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.

      • 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 tile
        pStream - 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

      • exists

         boolean exists(ITileSource pTileSource, long pMapTileIndex)

        return true if the map file for download already exists