Class DimapProductWriter

java.lang.Object
org.esa.snap.core.dataio.AbstractProductWriter
org.esa.snap.core.dataio.dimap.DimapProductWriter
All Implemented Interfaces:
ProductWriter

public class DimapProductWriter extends AbstractProductWriter
The product writer for the BEAM-DIMAP format.

The BEAM-DIMAP version history is provided in the API doc of the DimapProductWriterPlugIn.

Version:
$Revision$ $Date$
See Also:
  • Constructor Details

    • DimapProductWriter

      public DimapProductWriter(ProductWriterPlugIn writerPlugIn)
      Construct a new instance of a product writer for the given BEAM-DIMAP product writer plug-in.
      Parameters:
      writerPlugIn - the given BEAM-DIMAP product writer plug-in, must not be null
  • Method Details

    • setUseCache

      public void setUseCache(boolean useCache)
    • setCanceled

      public void setCanceled(boolean canceled)
    • getOutputDir

      public File getOutputDir()
      Returns the output directory of the product beeing written.
    • getBandOutputStreams

      public Map<Band,ImageOutputStream> getBandOutputStreams()
      Returns all band output streams opened so far.
    • writeProductNodesImpl

      protected void writeProductNodesImpl() throws IOException
      Writes the in-memory representation of a data product. This method was called by writeProductNodes(product, output) of the AbstractProductWriter.
      Specified by:
      writeProductNodesImpl in class AbstractProductWriter
      Throws:
      IllegalArgumentException - if output type is not one of the supported output sources.
      IOException - if an I/O error occurs
    • initDirs

      public void initDirs(File outputFile) throws IOException
      Initializes all the internal file and directory elements from the given output file. This method only must be called if the product writer should write the given data to raw data files without calling of writeProductNodes. This may be at the time when a dimap product was opened and the data should be continuously changed in the same product file without an previous call to the saveProductNodes to this product writer.
      Parameters:
      outputFile - the dimap header file location.
      Throws:
      IOException - if an I/O error occurs
    • writeBandRasterData

      public void writeBandRasterData(Band sourceBand, int sourceOffsetX, int sourceOffsetY, int sourceWidth, int sourceHeight, ProductData sourceBuffer, ProgressMonitor pm) throws IOException
      Writes raster data from the given in-memory source buffer into the data sink specified by the given source band and region.

      Source band

      The source band is used to identify the data sink in which this method transfers the sample values given in the source buffer. The method does not modify the pixel data of the given source band at all.

      Source buffer

      The first element of the source buffer corresponds to the given sourceOffsetX and sourceOffsetY of the source region. These parameters are an offset within the band's raster data and not an offset within the source buffer.
      The number of elements in the buffer must be exactly be sourceWidth * sourceHeight. The pixel values to be writte are considered to be stored in line-by-line order, so the raster X co-ordinate varies faster than the Y.

      Source region

      The given destination region specified by the sourceOffsetX, sourceOffsetY, sourceWidth and sourceHeight parameters is given in the source band's raster co-ordinates. These co-ordinates are identical with the destination raster co-ordinates since product writers do not support spectral or spatial subsets.
      Parameters:
      sourceBand - the source band which identifies the data sink to which to write the sample values
      sourceOffsetX - the X-offset in the band's raster co-ordinates
      sourceOffsetY - the Y-offset in the band's raster co-ordinates
      sourceWidth - the width of region to be written given in the band's raster co-ordinates
      sourceHeight - the height of region to be written given in the band's raster co-ordinates
      sourceBuffer - the source buffer which provides the sample values to be written
      pm - a monitor to inform the user about progress
      Throws:
      IOException - if an I/O error occurs
      See Also:
    • deleteOutput

      public void deleteOutput() throws IOException
      Deletes the physically representation of the product from the hard disk.
      Throws:
      IOException - if an I/O error occurs
    • flush

      public void flush() throws IOException
      Writes all data in memory to disk. After a flush operation, the writer can be closed safely
      Throws:
      IOException - on failure
    • close

      public void close() throws IOException
      Closes all output streams currently open.
      Throws:
      IOException - on failure
    • shouldWrite

      public boolean shouldWrite(ProductNode node)
      Description copied from class: AbstractProductWriter
      Returns wether the given product node is to be written.
      Specified by:
      shouldWrite in interface ProductWriter
      Overrides:
      shouldWrite in class AbstractProductWriter
      Parameters:
      node - the product node
      Returns:
      true if so
    • isIncrementalMode

      public boolean isIncrementalMode()
      Returns whether this product writer writes only modified product nodes.
      Specified by:
      isIncrementalMode in interface ProductWriter
      Overrides:
      isIncrementalMode in class AbstractProductWriter
      Returns:
      true if so
    • setIncrementalMode

      public void setIncrementalMode(boolean enabled)
      Enables resp. disables incremental writing of this product writer. By default, a reader should enable progress listening.
      Specified by:
      setIncrementalMode in interface ProductWriter
      Overrides:
      setIncrementalMode in class AbstractProductWriter
      Parameters:
      enabled - enables or disables progress listening.
    • removeBand

      public void removeBand(Band band)
      Description copied from class: AbstractProductWriter
      Overwrite this method to physicaly delete a Band from the writer's output file.
      Specified by:
      removeBand in interface ProductWriter
      Overrides:
      removeBand in class AbstractProductWriter
      Parameters:
      band - The band to delete.
    • addExtender

      public void addExtender(DimapProductWriter.WriterExtender writerExtender)