Package noaa.coastwatch.io.tile
Class TileCacheManager
java.lang.Object
noaa.coastwatch.io.tile.TileCacheManager
The
TileCacheManager
class provides convenient access to the
default tile cache.- Since:
- 3.3.1
- Author:
- Peter Hollemans
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The default tile maximum cache size property (specified in Mb). -
Constructor Summary
ModifierConstructorDescriptionprotected
TileCacheManager
(TileCache cache) Creates a new manager backed by the specified cache. -
Method Summary
Modifier and TypeMethodDescriptionstatic TileCacheManager
Gets the singleton instance of this class using the default cache tile class.getTile
(TileSource source, TilingScheme.TilePosition pos) Gets a tile from the cache for the specified source and position.static void
Tests this class.void
removeTilesForSource
(TileSource source) Removes all the tiles in the cache from the specified source.void
requestTiles
(TileSource source, int[] start, int[] length, Observer observer) Starts a delivery operation for the specified tiles.
-
Field Details
-
DEFAULT_MAX_CACHE_SIZE_PROP
The default tile maximum cache size property (specified in Mb).- See Also:
-
-
Constructor Details
-
TileCacheManager
Creates a new manager backed by the specified cache.- Parameters:
cache
- the cache to use for this manager.
-
-
Method Details
-
getInstance
Gets the singleton instance of this class using the default cache tile class.- Returns:
- the singleton instance.
-
getTile
public TilingScheme.Tile getTile(TileSource source, TilingScheme.TilePosition pos) throws IOException Gets a tile from the cache for the specified source and position. If no tile is available in the cache with a matching source and position, the tile is read from the source and cached for the next call to this method.- Parameters:
source
- the source for the tile data.pos
- the position of the tile in the scheme.- Returns:
- the tile specified.
- Throws:
IOException
- if there was an error reading the tile from the source.
-
requestTiles
Starts a delivery operation for the specified tiles. If any tiles are not already in the cache, they are read asynchronously.- Parameters:
source
- the tile source.start
- the starting data coordinates as [row, column].length
- the size of the data rectangle as [rows, columns].observer
- the tile delivery observer to notify of tiles becoming available. If some tiles are available immediately with no delay,Observer.update (Observable, Object)
is called with a null value for theObservable
, and the tile for theObject
for each tile (synchronously, before this method exits). For the remaining tiles that are only available after a delay,Observer.update (Observable, Object)
is called with theTileDeliveryOperation
as the Observable and the tile for theObject
.
-
removeTilesForSource
Removes all the tiles in the cache from the specified source.- Parameters:
source
- the tile source to remove all tiles.
-
main
Tests this class.- Parameters:
argv
- the array of command line parameters.- Throws:
Exception
-