Class XmlMetadata

java.lang.Object
org.esa.snap.core.metadata.GenericXmlMetadata
org.esa.snap.core.metadata.XmlMetadata

public abstract class XmlMetadata extends GenericXmlMetadata
Base metadata class that exposes helper methods for easier access of interesting metadata values.
  • Field Details

    • width

      protected int width
    • height

      protected int height
    • numBands

      protected int numBands
  • Constructor Details

    • XmlMetadata

      public XmlMetadata(String name)
      Constructs an instance of metadata class and assigns a name to the root MetadataElement.
      Parameters:
      name - The name of this instance, and also the initial name of the root element.
  • Method Details

    • getNumBands

      public abstract int getNumBands()
      Returns the number of bands of the product. This getter should be overridden in all derived classes because each metadata type may have a different hierarchy of nodes for getting this value.
      Returns:
      the number of bands
    • getProductName

      public abstract String getProductName()
      Returns the name of the product, as found in metadata. This getter should be overridden in all derived classes because each metadata type may have a different hierarchy of nodes for getting this value.
      Returns:
      The name of the product
    • getFormatName

      public abstract String getFormatName()
      Returns the name of the raster format (for example: TIFF, NITF, etc).

      This getter should be overridden in all derived classes because each metadata type may have a different hierarchy of nodes for getting this value.

      Returns:
      The raster format name/code.
    • getRasterWidth

      public abstract int getRasterWidth()
      Returns the width of the product, in pixels. This getter should be overridden in all derived classes because each metadata type may have a different hierarchy of nodes for getting this value.
      Returns:
      The width (in pixels) of the product.
    • getRasterHeight

      public abstract int getRasterHeight()
      Returns the height of the product, in pixels. This getter should be overridden in all derived classes because each metadata type may have a different hierarchy of nodes for getting this value.
      Returns:
      The height (in pixels) of the product.
    • getRasterFileNames

      public abstract String[] getRasterFileNames()
      Returns the names of raster files for the product. This getter should be overridden in all derived classes because each metadata type may have a different hierarchy of nodes for getting this value.
      Returns:
      An array of raster file names.
    • setName

      public void setName(String value)
      Sets the name of this metadata (and also the name of the root element).
      Overrides:
      setName in class GenericXmlMetadata
      Parameters:
      value - The name of the metadata file.
    • getProductStartTime

      public abstract ProductData.UTC getProductStartTime()
      Returns the product start time in UTC format. This method has to be implemented by subclasses since the value may be or may not be present in metadata, or may be in different formats for different products.
      Returns:
      the product start time
    • getProductEndTime

      public abstract ProductData.UTC getProductEndTime()
      Returns the product end time in UTC format. This method has to be implemented by subclasses since the value may be or may not be present in metadata, or may be in different formats for different products.
      Returns:
      the product end time
    • getCenterTime

      public abstract ProductData.UTC getCenterTime()
      Returns the product center time in UTC format. This method has to be implemented by subclasses since the value may be or may not be present in metadata, or may be in different formats for different products.
      Returns:
      the product center time.
    • getProductDescription

      public abstract String getProductDescription()
      Returns the product description, preferably from metadata
      Returns:
      the product description
    • asFloatArray

      protected float[] asFloatArray(String value, String separator)
      Converts the value to a float array.
      Parameters:
      value - The string list of values
      separator - The items separator
      Returns:
      An array of float values
    • asFloat

      protected float asFloat(String value)
      Silently converts a string to a float (i.e. without throwing exception for unconvertible values)
      Parameters:
      value - The value to be converted
      Returns:
      The float value or Float.NaN if the conversion cannot be performed.
    • asInt

      protected int asInt(String value)
      Silently converts a string to a int (i.e. without throwing exception for unconvertible values)
      Parameters:
      value - The value to be converted
      Returns:
      The int value or 0 if the conversion cannot be performed.