Package de.pco.common

Class UShortArray


public class UShortArray
extends AbstractUnsignedArray
Class represents the array of unsigned shorts.
Author:
PCO
  • Field Summary

    Fields
    Modifier and Type Field Description
    static int ELEMENT_MAX_VALUE  

    Fields 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).
    int length()
    Returns the number of values stored.

    Methods inherited from class de.pco.common.AbstractUnsignedArray

    equals, getInputStream, hashCode, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • 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

      public UShortArray​(int[] intArray) throws IllegalArgumentException
      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:
      getArray in class AbstractUnsignedArray
      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:
      getBackingArray in class AbstractUnsignedArray
      Returns:
    • length

      public int length()
      Returns the number of values stored.
      Specified by:
      length in class AbstractUnsignedArray
      Returns: