Package org.esa.snap.core.dataio.dimap
Class DimapProductWriter
java.lang.Object
org.esa.snap.core.dataio.AbstractProductWriter
org.esa.snap.core.dataio.dimap.DimapProductWriter
- All Implemented Interfaces:
ProductWriter
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:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDimapProductWriter(ProductWriterPlugIn writerPlugIn) Construct a new instance of a product writer for the given BEAM-DIMAP product writer plug-in. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtender(DimapProductWriter.WriterExtender writerExtender) voidclose()Closes all output streams currently open.voidDeletes the physically representation of the product from the hard disk.voidflush()Writes all data in memory to disk.Returns all band output streams opened so far.Returns the output directory of the product beeing written.voidInitializes all the internal file and directory elements from the given output file.booleanReturns whether this product writer writes only modified product nodes.voidremoveBand(Band band) Overwrite this method to physicaly delete aBandfrom the writer's output file.voidsetCanceled(boolean canceled) voidsetIncrementalMode(boolean enabled) Enables resp.voidsetUseCache(boolean useCache) booleanshouldWrite(ProductNode node) Returns wether the given product node is to be written.voidwriteBandRasterData(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.protected voidWrites the in-memory representation of a data product.Methods inherited from class org.esa.snap.core.dataio.AbstractProductWriter
checkOutput, getOutput, getSourceProduct, getWriterPlugIn, isInstanceOfValidOutputType, setFormatName, writeProductNodes
-
Constructor Details
-
DimapProductWriter
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 benull
-
-
Method Details
-
setUseCache
public void setUseCache(boolean useCache) -
setCanceled
public void setCanceled(boolean canceled) -
getOutputDir
Returns the output directory of the product beeing written. -
getBandOutputStreams
Returns all band output streams opened so far. -
writeProductNodesImpl
Writes the in-memory representation of a data product. This method was called bywriteProductNodes(product, output)of the AbstractProductWriter.- Specified by:
writeProductNodesImplin classAbstractProductWriter- Throws:
IllegalArgumentException- ifoutputtype is not one of the supported output sources.IOException- if an I/O error occurs
-
initDirs
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 givensourceOffsetXandsourceOffsetYof 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 besourceWidth * 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 thesourceOffsetX,sourceOffsetY,sourceWidthandsourceHeightparameters 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 valuessourceOffsetX- the X-offset in the band's raster co-ordinatessourceOffsetY- the Y-offset in the band's raster co-ordinatessourceWidth- the width of region to be written given in the band's raster co-ordinatessourceHeight- the height of region to be written given in the band's raster co-ordinatessourceBuffer- the source buffer which provides the sample values to be writtenpm- a monitor to inform the user about progress- Throws:
IOException- if an I/O error occurs- See Also:
-
deleteOutput
Deletes the physically representation of the product from the hard disk.- Throws:
IOException- if an I/O error occurs
-
flush
Writes all data in memory to disk. After a flush operation, the writer can be closed safely- Throws:
IOException- on failure
-
close
Closes all output streams currently open.- Throws:
IOException- on failure
-
shouldWrite
Description copied from class:AbstractProductWriterReturns wether the given product node is to be written.- Specified by:
shouldWritein interfaceProductWriter- Overrides:
shouldWritein classAbstractProductWriter- Parameters:
node- the product node- Returns:
trueif so
-
isIncrementalMode
public boolean isIncrementalMode()Returns whether this product writer writes only modified product nodes.- Specified by:
isIncrementalModein interfaceProductWriter- Overrides:
isIncrementalModein classAbstractProductWriter- Returns:
trueif 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:
setIncrementalModein interfaceProductWriter- Overrides:
setIncrementalModein classAbstractProductWriter- Parameters:
enabled- enables or disables progress listening.
-
removeBand
Description copied from class:AbstractProductWriterOverwrite this method to physicaly delete aBandfrom the writer's output file.- Specified by:
removeBandin interfaceProductWriter- Overrides:
removeBandin classAbstractProductWriter- Parameters:
band- The band to delete.
-
addExtender
-