Package org.esa.snap.core.dataio
Class AbstractProductBuilder
- java.lang.Object
-
- org.esa.snap.core.dataio.AbstractProductReader
-
- org.esa.snap.core.dataio.AbstractProductBuilder
-
- All Implemented Interfaces:
ProductReader
- Direct Known Subclasses:
ProductFlipper
,ProductSubsetBuilder
public abstract class AbstractProductBuilder extends AbstractProductReader
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Band,RasterDataNode>
bandMap
protected String
newProductDesc
protected String
newProductName
protected int
sceneRasterHeight
protected int
sceneRasterWidth
protected Product
sourceProduct
protected boolean
sourceProductOwner
-
Constructor Summary
Constructors Constructor Description AbstractProductBuilder(boolean sourceProductOwner)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static void
addAttribString(String name, String value, MetadataElement subsetElem)
protected void
addFlagCodingsToProduct(Product target)
protected void
addIndexCodingsToProduct(Product target)
protected void
addMetadataToProduct(Product product)
protected void
cloneFlags(FlagCoding sourceFlagCoding, FlagCoding destFlagCoding)
protected void
cloneIndexes(IndexCoding sourceFlagCoding, IndexCoding destFlagCoding)
protected void
cloneMetadataAttributes(MetadataElement sourceRoot, MetadataElement destRoot)
protected void
cloneMetadataElements(MetadataElement sourceRoot, MetadataElement destRoot, int level)
protected void
cloneMetadataElementsAndAttributes(MetadataElement sourceRoot, MetadataElement destRoot, int level)
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.protected void
disposeBandMap()
int
getSceneRasterHeight()
int
getSceneRasterWidth()
Product
getSourceProduct()
protected boolean
isInstanceOfValidInputType(Object input)
Checks if the given object is an instance of one of the valid input types for this product reader.boolean
isSourceProductOwner()
protected Product
readProductNodes(Product sourceProduct, ProductSubsetDef subsetDef, String name, String desc)
protected abstract Product
readProductNodesImpl()
Provides an implementation of thereadProductNodes
interface method.void
setNewProductDesc(String newProductDesc)
void
setNewProductName(String newProductName)
-
Methods inherited from class org.esa.snap.core.dataio.AbstractProductReader
buildTiePointGrid, buildTiePointGrid, configurePreferredTileSize, convertInputToPath, createTiePointGrid, getGridDiscontinutity, getInput, getProductComponents, getReaderPlugIn, getSubsetDef, isMetadataIgnored, isNodeAccepted, isSubsetReadingFullySupported, readBandRasterData, readBandRasterDataImpl, readProductNodes, setInput, setSubsetDef, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.esa.snap.core.dataio.ProductReader
readTiePointGridRasterData
-
-
-
-
Field Detail
-
sourceProduct
protected Product sourceProduct
-
sourceProductOwner
protected boolean sourceProductOwner
-
sceneRasterWidth
protected int sceneRasterWidth
-
sceneRasterHeight
protected int sceneRasterHeight
-
newProductName
protected String newProductName
-
newProductDesc
protected String newProductDesc
-
bandMap
protected Map<Band,RasterDataNode> bandMap
-
-
Method Detail
-
getSourceProduct
public Product getSourceProduct()
-
isSourceProductOwner
public boolean isSourceProductOwner()
-
setNewProductDesc
public void setNewProductDesc(String newProductDesc)
-
setNewProductName
public void setNewProductName(String newProductName)
-
getSceneRasterWidth
public int getSceneRasterWidth()
-
getSceneRasterHeight
public int getSceneRasterHeight()
-
readProductNodes
protected Product readProductNodes(Product sourceProduct, ProductSubsetDef subsetDef, String name, String desc) throws IOException
- Throws:
IOException
-
readProductNodesImpl
protected abstract Product readProductNodesImpl() throws IOException
Description copied from class:AbstractProductReader
Provides an implementation of thereadProductNodes
interface method. Clients implementing this method can be sure that the input object and eventually the subset information has already been set.This method is called as a last step in the
readProductNodes(input, subsetInfo)
method.- Specified by:
readProductNodesImpl
in classAbstractProductReader
- Returns:
- a new product instance
- Throws:
IOException
- if an I/O error occurs
-
close
public 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.- Specified by:
close
in interfaceProductReader
- Overrides:
close
in classAbstractProductReader
- Throws:
IOException
- if an I/O error occurs
-
addFlagCodingsToProduct
protected void addFlagCodingsToProduct(Product target)
-
addIndexCodingsToProduct
protected void addIndexCodingsToProduct(Product target)
-
addAttribString
protected static void addAttribString(String name, String value, MetadataElement subsetElem)
-
cloneFlags
protected void cloneFlags(FlagCoding sourceFlagCoding, FlagCoding destFlagCoding)
-
cloneIndexes
protected void cloneIndexes(IndexCoding sourceFlagCoding, IndexCoding destFlagCoding)
-
addMetadataToProduct
protected void addMetadataToProduct(Product product)
-
cloneMetadataElementsAndAttributes
protected void cloneMetadataElementsAndAttributes(MetadataElement sourceRoot, MetadataElement destRoot, int level)
-
cloneMetadataElements
protected void cloneMetadataElements(MetadataElement sourceRoot, MetadataElement destRoot, int level)
-
cloneMetadataAttributes
protected void cloneMetadataAttributes(MetadataElement sourceRoot, MetadataElement destRoot)
-
isInstanceOfValidInputType
protected boolean isInstanceOfValidInputType(Object input)
Description copied from class:AbstractProductReader
Checks if the given object is an instance of one of the valid input types for this product reader.- Overrides:
isInstanceOfValidInputType
in classAbstractProductReader
- Parameters:
input
- the input object passed toAbstractProductReader.readProductNodes(Object, ProductSubsetDef)
- Returns:
true
if so- See Also:
ProductReaderPlugIn.getInputTypes()
-
disposeBandMap
protected void disposeBandMap()
-
-