Class ProductData.UInt

  • All Implemented Interfaces:
    Cloneable
    Direct Known Subclasses:
    ProductData.UTC
    Enclosing class:
    ProductData

    public static class ProductData.UInt
    extends ProductData.Int
    The UInt class is a ProductData specialisation for unsigned 32-bit integer fields.

    Internally, data is stored in an array of the type int[].

    In order to preserve the accuracy for the unsigned int value range the getElemUIntAt method should be used to retrieve the data stored in this value instead of accessing the data array directly.

    Another method is to mask each of the array elements in order to get the unsigned type in the following way:

         int[] data = (int[]) value.getRaster();
         for (int i = 0; i %lt; data.length; i++) {
             long value = data[i] & 0xffffffffL;
             ...
         }
     
    • Constructor Detail

      • UInt

        public UInt​(int numElems)
        Constructs a new unsigned int value.
        Parameters:
        numElems - the number of elements, must not be less than one
      • UInt

        public UInt​(int[] array)
        Constructs a new unsigned int value.
        Parameters:
        array - the elements
      • UInt

        protected UInt​(long[] elems)
        Constructs a new unsigned int value.
        Parameters:
        elems - the elements
    • Method Detail

      • getElemIntAt

        public int getElemIntAt​(int index)
        Please refer to ProductData.getElemIntAt(int).

        IMPORTANT NOTE: This method returns the data element unchanged as it is sinternally stored (a 32-bit signed integer) and thus can also return negative values. Use getElemUIntAt which returns unsigned long values only.

        Overrides:
        getElemIntAt in class ProductData.Int
        Parameters:
        index - the value index, must be >=0 and <getNumDataElems()
      • setElems

        public void setElems​(Object data)
        Sets the data of this value. The data must be an array of the type int[] or String[] and have a length that is equal to the value returned by the getNumDataElems method.
        Overrides:
        setElems in class ProductData.Int
        Parameters:
        data - the data array
        Throws:
        IllegalArgumentException - if data is null or it is not an array of the required type or does not have the required array length.