|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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(ByteBuffer filledBuffer,
int width,
int height,
File cacheFile,
boolean shouldCreateCachefile,
RasterDataInfo dataInfo,
RasterGeoReference geoReference,
RasterCache cache)
Create a cached raster from the given bytebuffer. |
|
CacheRasterReader(RasterReader cachedReader,
File cacheFile,
RasterCache cache)
|
Method Summary | |
---|---|
long |
cacheFileSize()
|
boolean |
canCreateCacheFile()
|
boolean |
canLoad(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,
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(Object other)
|
void |
flush()
Writes all current in memory byte buffers to the cache file (if existing). |
String |
getDataLocationId()
|
RasterGeoReference |
getGeoReference()
|
int |
getHeight()
|
Set<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(File gridFile,
RasterIOOptions options)
Read the given raster file into an abstract raster. |
AbstractRaster |
load(InputStream stream,
RasterIOOptions options)
Read the given input stream into an abstract raster. |
protected void |
read(int columnId,
int rowId,
ByteBuffer buffer)
Reads the data from the grid. |
BufferResult |
read(RasterRect rect,
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(ByteBuffer filledBuffer, int width, int height, 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, File cacheFile, RasterCache cache)
cachedReader
- cacheFile
- cache
- Method Detail |
---|
public static CacheRasterReader createFromCache(RasterReader reader, 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(File gridFile, RasterIOOptions options) throws IOException
RasterReader
load
in interface RasterReader
load
in class GridFileReader
IOException
- may be thrown when there is a problem with reading the raster.protected void read(int columnId, int rowId, ByteBuffer buffer) throws IOException
GridReader
read
in class GridFileReader
IOException
public BufferResult read(RasterRect rect, ByteBuffer resultBuffer) throws IOException
read
in interface RasterReader
read
in class GridFileReader
rect
- to read.resultBuffer
- to store the result in
IOException
public long clear(boolean deleteCacheFile)
deleteCacheFile
- true if the cache file should be deleted as well.
public boolean deleteCacheFile()
public boolean canLoad(File filename)
RasterReader
canLoad
in interface RasterReader
canLoad
in class GridFileReader
public Set<String> getSupportedFormats()
getSupportedFormats
in interface RasterReader
getSupportedFormats
in class GridFileReader
Set
of (image) formats mime/types the implementation is able to read.public AbstractRaster load(InputStream stream, RasterIOOptions options) throws IOException
RasterReader
load
in interface RasterReader
load
in class GridReader
IOException
- may be thrown when there is a problem with reading the raster.public boolean shouldCreateCacheFile()
shouldCreateCacheFile
in interface RasterReader
shouldCreateCacheFile
in class GridReader
public RasterGeoReference getGeoReference()
getGeoReference
in interface RasterReader
getGeoReference
in class GridReader
public int getHeight()
getHeight
in interface RasterReader
getHeight
in class GridReader
public int getWidth()
getWidth
in interface RasterReader
getWidth
in class GridReader
public String getDataLocationId()
getDataLocationId
in interface RasterReader
getDataLocationId
in class GridFileReader
public long lastReadAccess()
System.currentTimeMillis()
of the last read operation.public long currentApproxMemory()
public long cacheFileSize()
public void dispose()
RasterReader
dispose
in interface RasterReader
dispose
in class GridFileReader
public 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(Object other)
equals
in class Object
public int hashCode()
Combining the hash code(s) computed above: result = 37 * result + code;
hashCode
in class Object
Object.hashCode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |