Package de.pco.common
Class UShortArray
java.lang.Object
de.pco.common.AbstractUnsignedArray
de.pco.common.UShortArray
public class UShortArray extends AbstractUnsignedArray
Class represents the array of unsigned shorts.
- Author:
- PCO
-
Field Summary
Fields Modifier and Type Field Description static intELEMENT_MAX_VALUEFields inherited from class de.pco.common.AbstractUnsignedArray
buffer -
Constructor Summary
Constructors Constructor Description UShortArray(int[] intArray)Constructs the class from the array of the real unsigned short values, stored in a int array.UShortArray(short[] shortArray)Wraps the array of (signed) shorts that are to be interpreted as the unsigned short values -
Method Summary
Modifier and Type Method Description int[]getArray()Converts the backing array of signed values into an array of unsigned ones and returns them as the int array.short[]getBackingArray()Returns the array of the (signed) short values stored in the buffer (each value is taken from two bytes).intlength()Returns the number of values stored.Methods inherited from class de.pco.common.AbstractUnsignedArray
equals, getInputStream, hashCode, toString
-
Field Details
-
ELEMENT_MAX_VALUE
public static final int ELEMENT_MAX_VALUE- See Also:
- Constant Field Values
-
-
Constructor Details
-
UShortArray
public UShortArray(short[] shortArray)Wraps the array of (signed) shorts that are to be interpreted as the unsigned short values- Parameters:
shortArray-
-
UShortArray
Constructs the class from the array of the real unsigned short values, stored in a int array. Performs also check of the value range.- Parameters:
intArray-- Throws:
IllegalArgumentException
-
-
Method Details
-
getArray
public int[] getArray()Converts the backing array of signed values into an array of unsigned ones and returns them as the int array.- Specified by:
getArrayin classAbstractUnsignedArray- Returns:
-
getBackingArray
public short[] getBackingArray()Returns the array of the (signed) short values stored in the buffer (each value is taken from two bytes). This method is to be called in case of ImageIO framework to read the BufferedImage.- Specified by:
getBackingArrayin classAbstractUnsignedArray- Returns:
-
length
public int length()Returns the number of values stored.- Specified by:
lengthin classAbstractUnsignedArray- Returns:
-