Interface ProductWriter

All Known Implementing Classes:
AbstractProductWriter, DimapProductWriter

public interface ProductWriter
An interface that supports writing a complete data product tree and single band rasters.
Version:
$Revision$ $Date$
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes all output streams currently open.
    void
    Complete deletes the physical representation of the given product from the file system.
    void
    Writes all data in memory to the data sink(s) associated with this writer.
    Retrives the current output destination object.
    Returns the plug-in which created this product writer.
    boolean
    Returns whether this product writer writes only modified product nodes.
    void
    Physically deletes a Band in a product writer's output.
    void
    setFormatName(String formatName)
    Sets selectable product format for writers which handle multiple formats.
    void
    setIncrementalMode(boolean enabled)
    Enables resp.
    boolean
    Returns whether the given product node is to be written.
    void
    writeBandRasterData(Band sourceBand, int sourceOffsetX, int sourceOffsetY, int sourceWidth, int sourceHeight, ProductData sourceBuffer, ProgressMonitor pm)
    Writes raster data from the given in-memory source buffer into the data sink specified by the given source band and region.
    void
    writeProductNodes(Product product, Object output)
    Writes the in-memory representation of a data product.
  • Method Details

    • getWriterPlugIn

      ProductWriterPlugIn getWriterPlugIn()
      Returns the plug-in which created this product writer.
      Returns:
      the product writer plug-in, should never be null
    • getOutput

      Object getOutput()
      Retrives the current output destination object. Thie return value might be null if the setOutput has not been called so far.
      Returns:
      the output
    • writeProductNodes

      void writeProductNodes(Product product, Object output) throws IOException
      Writes the in-memory representation of a data product.

      Whether the band data - the actual pixel values - is written out immediately or later when pixels are flushed, is up to the implementation.

      Parameters:
      product - the in-memory representation of the data product
      output - an object representing a valid output for this writer, might be a ImageOutputStream or other Object to use for future decoding.
      Throws:
      IllegalArgumentException - if output is null or it's type is not one of the supported output sources.
      IOException - if an I/O error occurs
    • writeBandRasterData

      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
      IllegalArgumentException - if the number of elements source buffer not equals sourceWidth * sourceHeight or the source region is out of the band's raster
      See Also:
    • flush

      void flush() throws IOException
      Writes all data in memory to the data sink(s) associated with this writer.
      Throws:
      IOException - if an I/O error occurs
    • close

      void close() throws IOException
      Closes all output streams currently open. A concrete implementation should call flush before performing the actual close-operation.
      Throws:
      IOException - if an I/O error occurs
    • shouldWrite

      boolean shouldWrite(ProductNode node)
      Returns whether the given product node is to be written.
      Parameters:
      node - the product node
      Returns:
      true if so
    • isIncrementalMode

      boolean isIncrementalMode()
      Returns whether this product writer writes only modified product nodes.
      Returns:
      true if so
    • setIncrementalMode

      void setIncrementalMode(boolean enabled)
      Enables resp. disables incremental writing of this product writer. By default, a reader should enable progress listening.
      Parameters:
      enabled - enables or disables progress listening.
    • deleteOutput

      void deleteOutput() throws IOException
      Complete deletes the physical representation of the given product from the file system.
      Throws:
      IOException - if an I/O error occurs
    • removeBand

      void removeBand(Band band)
      Physically deletes a Band in a product writer's output.
      Parameters:
      band - The band to delete.
    • setFormatName

      void setFormatName(String formatName)
      Sets selectable product format for writers which handle multiple formats.
      Parameters:
      formatName - The name of the file format.