org.deegree.coverage.raster.io.grid
Class GridFileReader

java.lang.Object
  extended by org.deegree.coverage.raster.io.grid.GridReader
      extended by org.deegree.coverage.raster.io.grid.GridFileReader
All Implemented Interfaces:
RasterReader
Direct Known Subclasses:
CacheRasterReader, SplittedBlobReader

public class GridFileReader
extends GridReader

The GridFileReader class TODO add class documentation here.

Version:
$Revision: 31644 $, $Date: 2011-08-24 22:27:43 +0200 (Wed, 24 Aug 2011) $
Author:
Rutger Bezema, last edited by: $Author: mschneider $

Field Summary
 
Fields inherited from class org.deegree.coverage.raster.io.grid.GridReader
infoFile, sampleSize
 
Constructor Summary
GridFileReader()
          An empty constructor used in the GridRasterIOProvider, to a location in time where no information is known yet.
GridFileReader(File gridFile, RasterIOOptions options)
           
GridFileReader(GridMetaInfoFile infoFile, File gridFile)
           
 
Method Summary
 boolean canLoad(File filename)
          Check if the raster reader is able to read the given raster file.
 void dispose()
          Signals the reader that it should try to dispose all in memory data.
 File file()
           
 String getDataLocationId()
           
 Set<String> getSupportedFormats()
           
protected  void instantiate(GridMetaInfoFile infoFile, File gridFile)
          Instantiates this grid reader with the given information.
protected  void leaveStreamOpen(boolean yesNo)
          Signals the gridfile reader that it should (not) close the stream after a read.
 AbstractRaster load(File gridFile, RasterIOOptions options)
          Read the given raster file 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)
           
protected  void readValuesFromTile(int tileColumn, int tileRow, RasterRect fRect, FileChannel channel, ByteBuffer resultBuffer)
           
 
Methods inherited from class org.deegree.coverage.raster.io.grid.GridReader
allocateTileBuffer, canReadTiles, getBytesPerTile, getEnvelope, getGeoReference, getHeight, getIntersectingTiles, getNumberOfTiles, getRasterDataInfo, getTile, getTileColumns, getTileData, getTileEnvelope, getTileId, getTileRasterHeight, getTileRasterWidth, getTileRows, getTilesPerBlob, getWidth, instantiate, load, setTilesPerBlob, shouldCreateCacheFile, snapToGrid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridFileReader

public GridFileReader()
An empty constructor used in the GridRasterIOProvider, to a location in time where no information is known yet.


GridFileReader

public GridFileReader(GridMetaInfoFile infoFile,
                      File gridFile)
Parameters:
infoFile -
gridFile -

GridFileReader

public GridFileReader(File gridFile,
                      RasterIOOptions options)
               throws IOException
Parameters:
gridFile -
options -
Throws:
IOException
Method Detail

instantiate

protected void instantiate(GridMetaInfoFile infoFile,
                           File gridFile)
Instantiates this grid reader with the given information.

Parameters:
infoFile -
gridFile -

leaveStreamOpen

protected void leaveStreamOpen(boolean yesNo)
Signals the gridfile reader that it should (not) close the stream after a read.

Parameters:
yesNo -

canLoad

public boolean canLoad(File filename)
Description copied from interface: RasterReader
Check if the raster reader is able to read the given raster file.

Returns:
true if the class can read the raster

getSupportedFormats

public Set<String> getSupportedFormats()
Returns:
a Set of (image) formats mime/types the implementation is able to read.

load

public AbstractRaster load(File gridFile,
                           RasterIOOptions options)
                    throws IOException
Description copied from interface: RasterReader
Read the given raster file into an abstract raster.

Returns:
the loaded raster
Throws:
IOException - may be thrown when there is a problem with reading the raster.

read

public BufferResult read(RasterRect rect,
                         ByteBuffer resultBuffer)
                  throws IOException
Parameters:
rect - to read.
resultBuffer - to store the result in
Returns:
the read buffer and its domain
Throws:
IOException

read

protected void read(int columnId,
                    int rowId,
                    ByteBuffer buffer)
             throws IOException
Description copied from class: GridReader
Reads the data from the grid.

Specified by:
read in class GridReader
Throws:
IOException

readValuesFromTile

protected void readValuesFromTile(int tileColumn,
                                  int tileRow,
                                  RasterRect fRect,
                                  FileChannel channel,
                                  ByteBuffer resultBuffer)
                           throws IOException
Parameters:
tileColumn -
tileRow -
fRect -
channel -
resultBuffer -
Throws:
IOException

file

public File file()
Returns:
the file from which the raster was read.

getDataLocationId

public String getDataLocationId()
Returns:
a String which identifies this reader for used the data source, for example the file name, or an url.

dispose

public void dispose()
Description copied from interface: RasterReader
Signals the reader that it should try to dispose all in memory data.



Copyright © 2011. All Rights Reserved.