org.openstreetmap.gui.jmapviewer
Class OsmFileCacheTileLoader.FileLoadJob

java.lang.Object
  extended by org.openstreetmap.gui.jmapviewer.OsmFileCacheTileLoader.FileLoadJob
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
OsmFileCacheTileLoader

protected class OsmFileCacheTileLoader.FileLoadJob
extends java.lang.Object
implements java.lang.Runnable


Field Summary
(package private)  long fileAge
           
(package private)  boolean fileTilePainted
           
(package private)  java.io.InputStream input
           
(package private)  TileSource source
           
(package private)  Tile tile
           
(package private)  java.io.File tileCacheDir
           
(package private)  java.io.File tileFile
           
(package private)  int tilex
           
(package private)  int tiley
           
(package private)  int zoom
           
 
Constructor Summary
OsmFileCacheTileLoader.FileLoadJob(TileSource source, int tilex, int tiley, int zoom)
           
 
Method Summary
protected  java.io.File getTileFile()
           
protected  boolean hasOsmTileETag(java.lang.String eTag)
           
protected  boolean isOsmTileNewer(long fileAge)
          Performs a HEAD request for retrieving the LastModified header value.
protected  java.lang.String loadETagfromFile()
           
protected  void loadOrUpdateTile()
           
protected  boolean loadTileFromFile()
           
protected  byte[] loadTileInBuffer(java.net.URLConnection urlConn)
           
 void run()
           
protected  void saveETagToFile(java.lang.String eTag)
           
protected  void saveTileToFile(byte[] rawData)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

input

java.io.InputStream input

tilex

int tilex

tiley

int tiley

zoom

int zoom

tile

Tile tile

source

TileSource source

tileCacheDir

java.io.File tileCacheDir

tileFile

java.io.File tileFile

fileAge

long fileAge

fileTilePainted

boolean fileTilePainted
Constructor Detail

OsmFileCacheTileLoader.FileLoadJob

public OsmFileCacheTileLoader.FileLoadJob(TileSource source,
                                          int tilex,
                                          int tiley,
                                          int zoom)
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable

loadOrUpdateTile

protected void loadOrUpdateTile()

loadTileFromFile

protected boolean loadTileFromFile()

loadTileInBuffer

protected byte[] loadTileInBuffer(java.net.URLConnection urlConn)
                           throws java.io.IOException
Throws:
java.io.IOException

isOsmTileNewer

protected boolean isOsmTileNewer(long fileAge)
                          throws java.io.IOException
Performs a HEAD request for retrieving the LastModified header value. Note: This does only work with servers providing the LastModified header:

Parameters:
fileAge -
Returns:
true if the tile on the server is newer than the file
Throws:
java.io.IOException

hasOsmTileETag

protected boolean hasOsmTileETag(java.lang.String eTag)
                          throws java.io.IOException
Throws:
java.io.IOException

getTileFile

protected java.io.File getTileFile()

saveTileToFile

protected void saveTileToFile(byte[] rawData)

saveETagToFile

protected void saveETagToFile(java.lang.String eTag)

loadETagfromFile

protected java.lang.String loadETagfromFile()