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 int
Number of bytes to skip between band.private static final int
For identifying place in the code that are restricted to the two-dimensional case.private GridGeometry
Domain of the raster returned by the lastread(…)
operation.(package private) final GridGeometry
The full image size together with the "grid to CRS" transform.(package private) final SampleModel
Image layout, which describes also the layout of data to read.private static final int
Index of a two-dimensional dimension selected by this reader.private static final int
Index 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 GridGeometry
Returns 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 theSampleModel
and needs to be handled at reading time instead. This is used withBandedSampleModel
only. -
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 withBandedSampleModel
only.input
- the channel from which to read the values, together with a buffer for transferring data.- Throws:
DataStoreContentException
- if the givendataType
is 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, ornull
for 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.
-