|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.deegree.coverage.raster.io.grid.GridReader
org.deegree.coverage.raster.io.grid.GridFileReader
org.deegree.coverage.raster.cache.CacheRasterReader
public class CacheRasterReader
The CacheRasterReader is a grid based caching mechanism for raster readers.
| Field Summary |
|---|
| Fields inherited from class org.deegree.coverage.raster.io.grid.GridReader |
|---|
infoFile, sampleSize |
| Constructor Summary | |
|---|---|
CacheRasterReader(java.nio.ByteBuffer filledBuffer,
int width,
int height,
java.io.File cacheFile,
boolean shouldCreateCachefile,
RasterDataInfo dataInfo,
RasterGeoReference geoReference,
RasterCache cache)
Create a cached raster from the given bytebuffer. |
|
CacheRasterReader(RasterReader cachedReader,
java.io.File cacheFile,
RasterCache cache)
|
|
| Method Summary | |
|---|---|
long |
cacheFileSize()
|
boolean |
canCreateCacheFile()
|
boolean |
canLoad(java.io.File filename)
Check if the raster reader is able to read the given raster file. |
long |
clear(boolean deleteCacheFile)
Clears all memory buffers and deletes the cache file if requested. |
static CacheRasterReader |
createFromCache(RasterReader reader,
java.io.File cacheFile,
RasterCache cache)
Creates a CachedRasterReader from the given cacheFile. |
long |
currentApproxMemory()
|
boolean |
deleteCacheFile()
Delete the file this cache reader is using. |
void |
dispose()
Signals the reader that it should try to dispose all in memory data. |
long |
dispose(boolean memoryBuffersAsWell)
Causes the cachefile to be written (if existing) and the memory buffers to be set to null. |
boolean |
equals(java.lang.Object other)
|
void |
flush()
Writes all current in memory byte buffers to the cache file (if existing). |
java.lang.String |
getDataLocationId()
|
RasterGeoReference |
getGeoReference()
|
int |
getHeight()
|
java.util.Set<java.lang.String> |
getSupportedFormats()
|
int |
getWidth()
|
int |
hashCode()
Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast. |
long |
lastReadAccess()
Return the current time millis of the last read action. |
AbstractRaster |
load(java.io.File gridFile,
RasterIOOptions options)
Read the given raster file into an abstract raster. |
AbstractRaster |
load(java.io.InputStream stream,
RasterIOOptions options)
Read the given input stream into an abstract raster. |
protected void |
read(int columnId,
int rowId,
java.nio.ByteBuffer buffer)
Reads the data from the grid. |
BufferResult |
read(RasterRect rect,
java.nio.ByteBuffer resultBuffer)
|
boolean |
shouldCreateCacheFile()
|
| Methods inherited from class org.deegree.coverage.raster.io.grid.GridFileReader |
|---|
file, instantiate, leaveStreamOpen, readValuesFromTile |
| Methods inherited from class org.deegree.coverage.raster.io.grid.GridReader |
|---|
allocateTileBuffer, canReadTiles, getBytesPerTile, getEnvelope, getIntersectingTiles, getNumberOfTiles, getRasterDataInfo, getTile, getTileColumns, getTileData, getTileEnvelope, getTileId, getTileRasterHeight, getTileRasterWidth, getTileRows, getTilesPerBlob, instantiate, setTilesPerBlob, snapToGrid |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CacheRasterReader(java.nio.ByteBuffer filledBuffer,
int width,
int height,
java.io.File cacheFile,
boolean shouldCreateCachefile,
RasterDataInfo dataInfo,
RasterGeoReference geoReference,
RasterCache cache)
filledBuffer - with values.width - of the raster for which this buffer is valid.height - of the raster for which this buffer is valid.cacheFile - to use for storageshouldCreateCachefile - if writing to disk should be enabled.dataInfo - defining the datageoReference - of the rastercache - used.
public CacheRasterReader(RasterReader cachedReader,
java.io.File cacheFile,
RasterCache cache)
cachedReader - cacheFile - cache - | Method Detail |
|---|
public static CacheRasterReader createFromCache(RasterReader reader,
java.io.File cacheFile,
RasterCache cache)
reader - which backs the cachecacheFile - to instantiate fromcache - manager to use.
CacheRasterReader or null if the cacheFile could not be read.
public AbstractRaster load(java.io.File gridFile,
RasterIOOptions options)
throws java.io.IOException
RasterReader
load in interface RasterReaderload in class GridFileReaderjava.io.IOException - may be thrown when there is a problem with reading the raster.
protected void read(int columnId,
int rowId,
java.nio.ByteBuffer buffer)
throws java.io.IOException
GridReader
read in class GridFileReaderjava.io.IOException
public BufferResult read(RasterRect rect,
java.nio.ByteBuffer resultBuffer)
throws java.io.IOException
read in interface RasterReaderread in class GridFileReaderrect - to read.resultBuffer - to store the result in
java.io.IOExceptionpublic long clear(boolean deleteCacheFile)
deleteCacheFile - true if the cache file should be deleted as well.
public boolean deleteCacheFile()
public boolean canLoad(java.io.File filename)
RasterReader
canLoad in interface RasterReadercanLoad in class GridFileReaderpublic java.util.Set<java.lang.String> getSupportedFormats()
getSupportedFormats in interface RasterReadergetSupportedFormats in class GridFileReaderSet of (image) formats mime/types the implementation is able to read.
public AbstractRaster load(java.io.InputStream stream,
RasterIOOptions options)
throws java.io.IOException
RasterReader
load in interface RasterReaderload in class GridReaderjava.io.IOException - may be thrown when there is a problem with reading the raster.public boolean shouldCreateCacheFile()
shouldCreateCacheFile in interface RasterReadershouldCreateCacheFile in class GridReaderpublic RasterGeoReference getGeoReference()
getGeoReference in interface RasterReadergetGeoReference in class GridReaderpublic int getHeight()
getHeight in interface RasterReadergetHeight in class GridReaderpublic int getWidth()
getWidth in interface RasterReadergetWidth in class GridReaderpublic java.lang.String getDataLocationId()
getDataLocationId in interface RasterReadergetDataLocationId in class GridFileReaderpublic long lastReadAccess()
System.currentTimeMillis() of the last read operation.public long currentApproxMemory()
public long cacheFileSize()
public void dispose()
RasterReader
dispose in interface RasterReaderdispose in class GridFileReaderpublic long dispose(boolean memoryBuffersAsWell)
memoryBuffersAsWell - if true the memorybuffers (the ones which don't have rasterfiles to back them up) will be deleted as
well.
public void flush()
public boolean canCreateCacheFile()
public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
Combining the hash code(s) computed above: result = 37 * result + code;
hashCode in class java.lang.ObjectObject.hashCode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||