Class RawRasterReader

java.lang.Object
org.apache.sis.internal.storage.io.HyperRectangleReader
org.apache.sis.internal.storage.esri.RawRasterReader

final class RawRasterReader extends HyperRectangleReader
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 Details

    • BIDIMENSIONAL

      private static final int BIDIMENSIONAL
      For identifying place in the code that are restricted to the two-dimensional case.
      See Also:
    • X_DIMENSION

      private static final int X_DIMENSION
      Index 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_DIMENSION
      Index 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

      final GridGeometry gridGeometry
      The full image size together with the "grid to CRS" transform.
    • layout

      final SampleModel layout
      Image layout, which describes also the layout of data to read.
    • bandGapBytes

      private final int bandGapBytes
      Number of bytes to skip between band. This information is not stored in the SampleModel and needs to be handled at reading time instead. This is used with BandedSampleModel only.
    • effectiveDomain

      private GridGeometry effectiveDomain
      Domain of the raster returned by the last read(…) 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 with BandedSampleModel only.
      input - the channel from which to read the values, together with a buffer for transferring data.
      Throws:
      DataStoreContentException - if the given dataType is not one of the supported values.
  • Method Details

    • read

      Loads the data. After successful completion, the domain effectively used can be obtained by getEffectiveDomain()
      Parameters:
      domain - desired grid extent and resolution, or null 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

      final GridGeometry getEffectiveDomain()
      Returns the domain of the raster returned by the last read(…) operation. This method should be invoked only once per read operation.