Package org.esa.snap.core.datamodel
Class ProductData.Short
- java.lang.Object
-
- org.esa.snap.core.datamodel.ProductData
-
- org.esa.snap.core.datamodel.ProductData.Short
-
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
ProductData.UShort
- Enclosing class:
- ProductData
public static class ProductData.Short extends ProductData
TheShortclass is aProductDataspecialisation for signed 16-bit integer fields.Internally, data is stored in an array of the type
short[].
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.esa.snap.core.datamodel.ProductData
ProductData.ASCII, ProductData.Byte, ProductData.Double, ProductData.Float, ProductData.Int, ProductData.Long, ProductData.Short, ProductData.UByte, ProductData.UInt, ProductData.UShort, ProductData.UTC
-
-
Field Summary
Fields Modifier and Type Field Description protected short[]_arrayThe internal data array holding this value's data elements.-
Fields inherited from class org.esa.snap.core.datamodel.ProductData
TYPE_ASCII, TYPE_FLOAT32, TYPE_FLOAT64, TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, TYPE_UINT8, TYPE_UNDEFINED, TYPE_UTC, TYPESTRING_ASCII, TYPESTRING_FLOAT32, TYPESTRING_FLOAT64, TYPESTRING_INT16, TYPESTRING_INT32, TYPESTRING_INT64, TYPESTRING_INT8, TYPESTRING_UINT16, TYPESTRING_UINT32, TYPESTRING_UINT64, TYPESTRING_UINT8, TYPESTRING_UTC
-
-
Constructor Summary
Constructors Modifier Constructor Description Short(int numElems)Constructs a new signedshortvalue.protectedShort(int numElems, boolean unsigned)Constructs a new signedshortvalue.Short(short[] array)Constructs a new signedshortvalue.protectedShort(short[] array, boolean unsigned)Constructs a new signedshortvalue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ProductDatacreateDeepClone()Retuns a "deep" copy of this product data.voiddispose()Releases all of the resources used by this object instance and all of its owned children.short[]getArray()Returns the internal data array holding this value's data elements.doublegetElemDoubleAt(int index)Please refer toProductData.getElemDoubleAt(int).floatgetElemFloatAt(int index)Please refer toProductData.getElemFloatAt(int).intgetElemIntAt(int index)Please refer toProductData.getElemIntAt(int).longgetElemLongAt(int index)Please refer toProductData.getElemLongAt(int).ObjectgetElems()Gets the actual value value(s).StringgetElemStringAt(int index)Please refer toProductData.getElemStringAt(int).longgetElemUIntAt(int index)Please refer toProductData.getElemUIntAt(int).intgetNumElems()Returns the number of data elements this value has.voidreadFrom(int startPos, int numElems, ImageInputStream source)Please refer toProductData.readFrom(int, int, ImageInputStream).voidsetElemDoubleAt(int index, double value)Please refer toProductData.setElemDoubleAt(int, double).voidsetElemFloatAt(int index, float value)Please refer toProductData.setElemFloatAt(int, float).voidsetElemIntAt(int index, int value)Please refer toProductData.setElemIntAt(int, int).voidsetElemLongAt(int index, long value)Please refer toProductData.setElemLongAt(int, long).voidsetElems(Object data)Sets the data of this value.voidsetElemUIntAt(int index, long value)Please refer toProductData.setElemUIntAt(int, long).voidwriteTo(int sourceStartPos, int numSourceElems, ImageOutputStream destination)Please refer toProductData.writeTo(int, int, ImageOutputStream).-
Methods inherited from class org.esa.snap.core.datamodel.ProductData
createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createInstance, createUnsignedInstance, createUnsignedInstance, createUnsignedInstance, equalElems, equals, getElemBoolean, getElemBooleanAt, getElemDouble, getElemFloat, getElemInt, getElemLong, getElemSize, getElemSize, getElemString, getElemUInt, getType, getType, getTypeString, getTypeString, hashCode, isFloatingPointType, isInt, isIntType, isScalar, isSigned, isUIntType, isUnsigned, readFrom, readFrom, readFrom, setElemBoolean, setElemBooleanAt, setElemDouble, setElemFloat, setElemInt, setElemLong, setElemString, setElemStringAt, setElemUInt, toString, writeTo, writeTo, writeTo
-
-
-
-
Constructor Detail
-
Short
public Short(int numElems)
Constructs a new signedshortvalue.- Parameters:
numElems- the number of elements, must not be less than one
-
Short
protected Short(int numElems, boolean unsigned)Constructs a new signedshortvalue.- Parameters:
numElems- the number of elements, must not be less than oneunsigned- iftruean unsigned value type is constructed
-
Short
public Short(short[] array)
Constructs a new signedshortvalue.- Parameters:
array- the elements
-
Short
protected Short(short[] array, boolean unsigned)Constructs a new signedshortvalue.- Parameters:
array- the elementsunsigned- iftruean unsigned value type is constructed
-
-
Method Detail
-
createDeepClone
protected ProductData createDeepClone()
Retuns a "deep" copy of this product data.- Specified by:
createDeepClonein classProductData- Returns:
- a copy of this product data
-
getNumElems
public int getNumElems()
Returns the number of data elements this value has.- Specified by:
getNumElemsin classProductData
-
getElemIntAt
public int getElemIntAt(int index)
Please refer toProductData.getElemIntAt(int).- Specified by:
getElemIntAtin classProductData- Parameters:
index- the value index, must be>=0and<getNumDataElems()
-
getElemUIntAt
public long getElemUIntAt(int index)
Please refer toProductData.getElemUIntAt(int).- Specified by:
getElemUIntAtin classProductData- Parameters:
index- the value index, must be>=0and<getNumDataElems()
-
getElemLongAt
public long getElemLongAt(int index)
Please refer toProductData.getElemLongAt(int).- Specified by:
getElemLongAtin classProductData- Parameters:
index- the value index, must be>=0and<getNumDataElems()
-
getElemFloatAt
public float getElemFloatAt(int index)
Please refer toProductData.getElemFloatAt(int).- Specified by:
getElemFloatAtin classProductData- Parameters:
index- the value index, must be>=0and<getNumDataElems()
-
getElemDoubleAt
public double getElemDoubleAt(int index)
Please refer toProductData.getElemDoubleAt(int).- Specified by:
getElemDoubleAtin classProductData- Parameters:
index- the value index, must be>=0and<getNumDataElems()
-
getElemStringAt
public String getElemStringAt(int index)
Please refer toProductData.getElemStringAt(int).- Specified by:
getElemStringAtin classProductData- Parameters:
index- the value index, must be>=0and<getNumDataElems()
-
setElemIntAt
public void setElemIntAt(int index, int value)Please refer toProductData.setElemIntAt(int, int).- Specified by:
setElemIntAtin classProductData- Parameters:
index- the value index, must be>=0and<getNumDataElems()value- the value to be set
-
setElemUIntAt
public void setElemUIntAt(int index, long value)Please refer toProductData.setElemUIntAt(int, long).- Specified by:
setElemUIntAtin classProductData- Parameters:
index- the value index, must be>=0and<getNumDataElems()value- the value to be set
-
setElemLongAt
public void setElemLongAt(int index, long value)Please refer toProductData.setElemLongAt(int, long).- Specified by:
setElemLongAtin classProductData- Parameters:
index- the value index, must be>=0and<getNumDataElems()value- the value to be set
-
setElemFloatAt
public void setElemFloatAt(int index, float value)Please refer toProductData.setElemFloatAt(int, float).- Specified by:
setElemFloatAtin classProductData- Parameters:
index- the value index, must be>=0and<getNumDataElems()value- the value to be set
-
setElemDoubleAt
public void setElemDoubleAt(int index, double value)Please refer toProductData.setElemDoubleAt(int, double).- Specified by:
setElemDoubleAtin classProductData- Parameters:
index- the value index, must be>=0and<getNumDataElems()value- the value to be set
-
getArray
public final short[] getArray()
Returns the internal data array holding this value's data elements.- Returns:
- the internal data array, never
null
-
getElems
public Object getElems()
Gets the actual value value(s). The value returned can safely been casted to an array object of the typeshort[].- Specified by:
getElemsin classProductData- Returns:
- this value's value, always a
short[], nevernull
-
setElems
public void setElems(Object data)
Sets the data of this value. The data must be an array of the typeshort[]orString[]and have a length that is equal to the value returned by thegetNumDataElemsmethod.- Specified by:
setElemsin classProductData- Parameters:
data- the data array- Throws:
IllegalArgumentException- if data isnullor it is not an array of the required type or does not have the required array length.
-
readFrom
public void readFrom(int startPos, int numElems, ImageInputStream source) throws IOExceptionPlease refer toProductData.readFrom(int, int, ImageInputStream).- Specified by:
readFromin classProductData- Parameters:
startPos- the destination start position (zero-based)numElems- the number of elements to readsource- a seekable data input stream- Throws:
IOException- if an I/O error occurs
-
writeTo
public void writeTo(int sourceStartPos, int numSourceElems, ImageOutputStream destination) throws IOExceptionPlease refer toProductData.writeTo(int, int, ImageOutputStream).- Specified by:
writeToin classProductData- Parameters:
sourceStartPos- the source start position (zero-based)numSourceElems- the number of elements to be writtendestination- a seekable data output stream- Throws:
IOException- if an I/O error occurs
-
dispose
public void dispose()
Releases all of the resources used by this object instance and all of its owned children. 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
dispose()are undefined.Overrides of this method should always call
super.dispose();after disposing this instance.- Specified by:
disposein classProductData
-
-