Package org.esa.snap.core.dataio
Interface ProductReader
-
- All Known Implementing Classes:
AbstractProductBuilder
,AbstractProductReader
,DimapProductReader
,ImageProductReader
,ProductFlipper
,ProductFlipperExt
,ProductSubsetBuilder
public interface ProductReader
Classes implementing theProductReader
interface know how to create an in-memory representation of a given data product as input source. Consider reading the developer guide when implementing a new product reader in the wiki:
How to create a new product reader- Version:
- $Revision$ $Date$
- See Also:
ProductWriter
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
close()
Closes the access to all currently opened resources such as file input streams and all resources of this children directly owned by this reader.Object
getInput()
Retrieves the current input destination object.ProductReaderPlugIn
getReaderPlugIn()
Returns the plug-in which created this product reader.ProductSubsetDef
getSubsetDef()
Returns the subset information with which this a data product is read from its physical source.void
readBandRasterData(Band destBand, int destOffsetX, int destOffsetY, int destWidth, int destHeight, ProductData destBuffer, ProgressMonitor pm)
Reads raster data from the data source specified by the given destination band into the given in-memory buffer and region.Product
readProductNodes(Object input, ProductSubsetDef subsetDef)
Reads a data product and returns a in-memory representation of it.default void
readTiePointGridRasterData(TiePointGrid tpg, int destOffsetX, int destOffsetY, int destWidth, int destHeight, ProductData destBuffer, ProgressMonitor pm)
-
-
-
Method Detail
-
getReaderPlugIn
ProductReaderPlugIn getReaderPlugIn()
Returns the plug-in which created this product reader.- Returns:
- the product reader plug-in, should never be
null
-
getInput
Object getInput()
Retrieves the current input destination object. The return value might benull
if the input has not been set so far.
-
getSubsetDef
ProductSubsetDef getSubsetDef()
Returns the subset information with which this a data product is read from its physical source.- Returns:
- the subset information, can be
null
-
readProductNodes
Product readProductNodes(Object input, ProductSubsetDef subsetDef) throws IOException, IllegalFileFormatException
Reads a data product and returns a in-memory representation of it.The given subset info can be used to specify spatial and spectral portions of the original product. If the subset is omitted, the complete product is read in.
Whether the band data - the actual pixel values - is read in immediately or later when pixels are requested, is up to the implementation.
- Parameters:
input
- an object representing a valid output for this product reader, might be aImageInputStream
or otherObject
to use for future decoding.subsetDef
- a spectral or spatial subset (or both) of the product. Ifnull
, the entire product is read in- Throws:
IllegalArgumentException
- ifinput
isnull
or it's type is not one of the supported input sources.IOException
- if an I/O error occursIllegalFileFormatException
- if the file format is illegal
-
readTiePointGridRasterData
default void readTiePointGridRasterData(TiePointGrid tpg, int destOffsetX, int destOffsetY, int destWidth, int destHeight, ProductData destBuffer, ProgressMonitor pm) throws IOException
- Throws:
IOException
-
readBandRasterData
void readBandRasterData(Band destBand, int destOffsetX, int destOffsetY, int destWidth, int destHeight, ProductData destBuffer, ProgressMonitor pm) throws IOException
Reads raster data from the data source specified by the given destination band into the given in-memory buffer and region.Destination band
The destination band is used to identify the data source from which this method transfers the sample values into the given destination buffer. The method does not modify the given destination band at all. If this product reader has aProductSubsetDef
instance attached to it, the method should also consider the specified spatial subset and sub-sampling (if any) applied to the destination band.Destination region
The given destination region specified by thedestOffsetX
,destOffsetY
,destWidth
anddestHeight
parameters are given in the band's raster co-ordinates of the raster which results after applying the optional spatial subset and sub-sampling given by theProductSubsetDef
instance to the data source. If no spatial subset and sub-sampling is specified, the destination co-ordinates are identical with the source co-ordinates. The destination region should always specify a sub-region of the band's scene raster.Destination buffer
The first element of the destination buffer corresponds to the givendestOffsetX
anddestOffsetY
of the destination region. The offset parameters are not an offset within the buffer.
The number of elements in the buffer exactly bedestWidth * destHeight
. The pixel values read are stored in line-by-line order, so the raster X co-ordinate varies faster than the Y co-ordinate.- Parameters:
destBand
- the destination band which identifies the data source from which to read the sample valuesdestOffsetX
- the X-offset in the band's raster co-ordinatesdestOffsetY
- the Y-offset in the band's raster co-ordinatesdestWidth
- the width of region to be read given in the band's raster co-ordinatesdestHeight
- the height of region to be read given in the band's raster co-ordinatesdestBuffer
- the destination buffer which receives the sample values to be read- Throws:
IOException
- if an I/O error occursIllegalArgumentException
- if the number of elements destination buffer not equalsdestWidth * destHeight
or the destination region is out of the band's scene raster- See Also:
AbstractBand.getRasterWidth()
,AbstractBand.getRasterHeight()
-
close
void close() throws IOException
Closes the access to all currently opened resources such as file input streams and all resources of this children directly owned by this reader. Its primary use is to allow the garbage collector to perform a vanilla job.This method should be called only if it is for sure that this object instance will never be used again. The results of referencing an instance of this class after a call to
close()
are undefined.Overrides of this method should always call
super.close();
after disposing this instance.- Throws:
IOException
- if an I/O error occurs
-
-