Class RawRasterReader
java.lang.Object
org.apache.sis.internal.storage.io.HyperRectangleReader
org.apache.sis.internal.storage.esri.RawRasterReader
Helper class for reading a raw raster. The layout of data to read is defined by the
SampleModel.
This class does not manage sample dimensions or color model; it is about sample values only.
This class is not thread-safe. Synchronization, if needed, shall be done by the caller.
- Since:
- 1.2
- Version:
- 1.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intNumber of bytes to skip between band.private static final intFor identifying place in the code that are restricted to the two-dimensional case.private GridGeometryDomain of the raster returned by the lastread(…)operation.(package private) final GridGeometryThe full image size together with the "grid to CRS" transform.(package private) final SampleModelImage layout, which describes also the layout of data to read.private static final intIndex of a two-dimensional dimension selected by this reader.private static final intIndex of a two-dimensional dimension selected by this reader. -
Constructor Summary
ConstructorsConstructorDescriptionRawRasterReader(GridGeometry gridGeometry, SampleModel layout, int bandGapBytes, ChannelDataInput input) Creates a new reader for the given input. -
Method Summary
Modifier and TypeMethodDescription(package private) final GridGeometryReturns the domain of the raster returned by the lastread(…)operation.read(GridGeometry domain, RangeArgument range) Loads the data.Methods inherited from class org.apache.sis.internal.storage.io.HyperRectangleReader
filename, getOrigin, read, readAsBuffer, sampleSize, setOrigin
-
Field Details
-
BIDIMENSIONAL
private static final int BIDIMENSIONALFor identifying place in the code that are restricted to the two-dimensional case.- See Also:
-
X_DIMENSION
private static final int X_DIMENSIONIndex of a two-dimensional dimension selected by this reader. Note that the (x,y) axis order also appears implicitly in some method calls; modifying the values of those constants is not sufficient if different axis indices were wanted.- See Also:
-
Y_DIMENSION
private static final int Y_DIMENSIONIndex of a two-dimensional dimension selected by this reader. Note that the (x,y) axis order also appears implicitly in some method calls; modifying the values of those constants is not sufficient if different axis indices were wanted.- See Also:
-
gridGeometry
The full image size together with the "grid to CRS" transform. -
layout
Image layout, which describes also the layout of data to read. -
bandGapBytes
private final int bandGapBytesNumber of bytes to skip between band. This information is not stored in theSampleModeland needs to be handled at reading time instead. This is used withBandedSampleModelonly. -
effectiveDomain
Domain of the raster returned by the lastread(…)operation.- See Also:
-
-
Constructor Details
-
RawRasterReader
public RawRasterReader(GridGeometry gridGeometry, SampleModel layout, int bandGapBytes, ChannelDataInput input) throws DataStoreContentException Creates a new reader for the given input.- Parameters:
gridGeometry- the full image size together with the "grid to CRS" transform.layout- the image layout, which describes also the layout of data to read.bandGapBytes- Number of bytes to skip between band. Used withBandedSampleModelonly.input- the channel from which to read the values, together with a buffer for transferring data.- Throws:
DataStoreContentException- if the givendataTypeis not one of the supported values.
-
-
Method Details
-
read
public WritableRaster read(GridGeometry domain, RangeArgument range) throws DataStoreException, IOException Loads the data. After successful completion, the domain effectively used can be obtained bygetEffectiveDomain()- Parameters:
domain- desired grid extent and resolution, ornullfor reading the whole domain.range- indices of bands to load.- Returns:
- the raster for the specified domain.
- Throws:
DataStoreException- if an error occurred while reading the raster data.IOException- if an I/O error occurred.
-
getEffectiveDomain
Returns the domain of the raster returned by the lastread(…)operation. This method should be invoked only once per read operation.
-