org.openstreetmap.gui.jmapviewer
Class OsmFileCacheTileLoader.FileLoadJob

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

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


Field Summary
(package private)  long fileAge
           
(package private)  boolean fileTilePainted
           
(package private)  java.io.InputStream input
           
(package private)  Tile tile
           
(package private)  java.io.File tileCacheDir
           
(package private)  java.io.File tileFile
           
 
Constructor Summary
OsmFileCacheTileLoader.FileLoadJob(Tile tile)
           
 
Method Summary
protected  java.io.File getTagsFile()
           
 Tile getTile()
          Function to return the tile associated with the job
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.
private  void loadOldETagfromFile()
          Load backward-compatiblity .etag file and if it exists move it to new .tags file
protected  void loadOrUpdateTile()
           
protected  void loadTagsFromFile()
           
protected  boolean loadTileFromFile()
           
protected  byte[] loadTileInBuffer(java.net.URLConnection urlConn)
           
 void run()
           
protected  void saveTagsToFile()
           
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

tile

Tile tile

tileCacheDir

java.io.File tileCacheDir

tileFile

java.io.File tileFile

fileAge

long fileAge

fileTilePainted

boolean fileTilePainted
Constructor Detail

OsmFileCacheTileLoader.FileLoadJob

public OsmFileCacheTileLoader.FileLoadJob(Tile tile)
Method Detail

getTile

public Tile getTile()
Description copied from interface: TileJob
Function to return the tile associated with the job

Specified by:
getTile in interface TileJob
Returns:
Tile to be handled

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 - time of the
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()

getTagsFile

protected java.io.File getTagsFile()

saveTileToFile

protected void saveTileToFile(byte[] rawData)

saveTagsToFile

protected void saveTagsToFile()

loadOldETagfromFile

private void loadOldETagfromFile()
Load backward-compatiblity .etag file and if it exists move it to new .tags file


loadTagsFromFile

protected void loadTagsFromFile()


JOSM