org.esa.beam.framework.datamodel
Class ProductData.UByte

java.lang.Object
  extended by org.esa.beam.framework.datamodel.ProductData
      extended by org.esa.beam.framework.datamodel.ProductData.Byte
          extended by org.esa.beam.framework.datamodel.ProductData.UByte
All Implemented Interfaces:
Cloneable
Enclosing class:
ProductData

public static class ProductData.UByte
extends ProductData.Byte

The UByte class is a ProductData specialisation for unsigned 8-bit integer fields.

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

In order to preserve the accuracy for the unsigned byte value range the getElemIntAt 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:

     byte[] data = (byte[]) value.getElems();
     for (int i = 0; i < data.length; i++) {
         int value = data[i] & 0xff;
         ...
     }
 


Nested Class Summary
 
Nested classes/interfaces inherited from class org.esa.beam.framework.datamodel.ProductData
ProductData.ASCII, ProductData.Byte, ProductData.Double, ProductData.Float, ProductData.Int, ProductData.Short, ProductData.UByte, ProductData.UInt, ProductData.UShort, ProductData.UTC
 
Field Summary
 
Fields inherited from class org.esa.beam.framework.datamodel.ProductData.Byte
_array
 
Fields inherited from class org.esa.beam.framework.datamodel.ProductData
TYPE_ASCII, TYPE_FLOAT32, TYPE_FLOAT64, TYPE_INT16, TYPE_INT32, TYPE_INT8, TYPE_UINT16, TYPE_UINT32, TYPE_UINT8, TYPE_UNDEFINED, TYPE_UTC, TYPESTRING_ASCII, TYPESTRING_FLOAT32, TYPESTRING_FLOAT64, TYPESTRING_INT16, TYPESTRING_INT32, TYPESTRING_INT8, TYPESTRING_UINT16, TYPESTRING_UINT32, TYPESTRING_UINT8, TYPESTRING_UTC
 
Constructor Summary
ProductData.UByte(byte[] array)
          Constructs a new unsigned byte value.
ProductData.UByte(int numElems)
          Constructs a new unsigned byte value.
 
Method Summary
protected  ProductData createDeepClone()
          Retuns a "deep" copy of this product data.
 double getElemDoubleAt(int index)
          Please refer to ProductData.getElemDoubleAt(int).
 float getElemFloatAt(int index)
          Please refer to ProductData.getElemFloatAt(int).
 int getElemIntAt(int index)
          Please refer to ProductData.getElemIntAt(int).
 String getElemStringAt(int index)
          Please refer to ProductData.getElemStringAt(int).
 long getElemUIntAt(int index)
          Please refer to ProductData.getElemUIntAt(int).
 void setElems(Object data)
          Sets the data of this value.
 
Methods inherited from class org.esa.beam.framework.datamodel.ProductData.Byte
clone, dispose, getArray, getElems, getNumElems, readFrom, setElemDoubleAt, setElemFloatAt, setElemIntAt, setElemUIntAt, writeTo
 
Methods inherited from class org.esa.beam.framework.datamodel.ProductData
createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createUnsignedInstance, createUnsignedInstance, createUnsignedInstance, equalElems, equals, getElemBoolean, getElemBooleanAt, getElemDouble, getElemFloat, getElemInt, getElemSize, getElemSize, getElemString, getElemUInt, getType, getType, getTypeString, getTypeString, hashCode, isFloatingPointType, isInt, isIntType, isScalar, isSigned, isUIntType, isUnsigned, readFrom, readFrom, readFrom, setElemBoolean, setElemBooleanAt, setElemDouble, setElemFloat, setElemInt, setElemString, setElemStringAt, setElemUInt, toString, writeTo, writeTo, writeTo
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProductData.UByte

public ProductData.UByte(int numElems)
Constructs a new unsigned byte value.

Parameters:
numElems - the number of elements, must not be less than one

ProductData.UByte

public ProductData.UByte(byte[] array)
Constructs a new unsigned byte value.

Parameters:
array - the elements
Method Detail

createDeepClone

protected ProductData createDeepClone()
Retuns a "deep" copy of this product data.

Overrides:
createDeepClone in class ProductData.Byte
Returns:
a copy of this product data

getElemIntAt

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

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

getElemUIntAt

public long getElemUIntAt(int index)
Please refer to ProductData.getElemUIntAt(int).

Overrides:
getElemUIntAt in class ProductData.Byte
Parameters:
index - the value index, must be >=0 and <getNumDataElems()

getElemFloatAt

public float getElemFloatAt(int index)
Please refer to ProductData.getElemFloatAt(int).

Overrides:
getElemFloatAt in class ProductData.Byte
Parameters:
index - the value index, must be >=0 and <getNumDataElems()

getElemDoubleAt

public double getElemDoubleAt(int index)
Please refer to ProductData.getElemDoubleAt(int).

Overrides:
getElemDoubleAt in class ProductData.Byte
Parameters:
index - the value index, must be >=0 and <getNumDataElems()

getElemStringAt

public String getElemStringAt(int index)
Please refer to ProductData.getElemStringAt(int).

Overrides:
getElemStringAt in class ProductData.Byte
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 byte[] or String[] and have a length that is equal to the value returned by the getNumDataElems method.

Overrides:
setElems in class ProductData.Byte
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.


Copyright © 2002-2012 Brockmann Consult GmbH. All Rights Reserved.