Package de.pco.common

Class AbstractUnsignedArray

java.lang.Object
de.pco.common.AbstractUnsignedArray
Direct Known Subclasses:
UByteArray, UShortArray

public abstract class AbstractUnsignedArray
extends Object
Abstract class that represents an array of values of an unsigned data type. Due to the inabilities of Java, these are stored in the backing buffer as the signed values of a particular Java data type and get converted to the array of unsigned values when getArray() is called.
Author:
PCO
  • Field Details

  • Constructor Details

    • AbstractUnsignedArray

      protected AbstractUnsignedArray​(Object signedSubtypeArray)
      This constructor from the array of bytes or shorts will be used after the native call to record the data will be performed in the C level of JNI.
      Parameters:
      signedSubtypeArray -
    • AbstractUnsignedArray

      protected AbstractUnsignedArray​(int[] array) throws IllegalArgumentException
      Constructor for creating the array from the real unsigned values. This would be used after manual computation with the image values to wrap the array again.
      Parameters:
      array -
      Throws:
      IllegalArgumentException
  • Method Details

    • getArray

      public abstract int[] getArray()
      Returns the factual array of unsigned values. To be called when there is a need for displaying or manually counting with the real values. Converts from the backing byte array every time.
      Returns:
    • getBackingArray

      public abstract Object getBackingArray()
      Returns the array as it is stored in the buffer as the array of a particular Java data type. To be used for reading to a BufferedImage in the ImageIO framework.
      Returns:
    • getInputStream

      public InputStream getInputStream()
      Returns an InputStream on the backing buffer.
      Returns:
    • length

      public abstract int length()
      Returns the number of stored values, i.e. the length of both arrays returned by getArray() and getBackingArray().
      Returns:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals​(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object