Class ShortPtr

All Implemented Interfaces:
Iterable<ShortPtr>

public final class ShortPtr
extends Struct<ShortPtr>
Points to a 16-bit signed value (short * in C).
  • Constructor Details

    • ShortPtr

      public ShortPtr()
      Creates a new ShortPtr with a value of 0.
    • ShortPtr

      public ShortPtr​(short value)
      Creates a new ShortPtr and initializes it with the specified value.
      Parameters:
      value - the value.
  • Method Details

    • get

      public short get()
      Returns the current value.
      Returns:
      the value.
    • set

      public void set​(short value)
      Sets the value.
      Parameters:
      value - the new value.
    • asShortBuffer

      public ShortBuffer asShortBuffer​(int n)
      Returns a ShortBuffer which reads and writes to the same memory location pointed to by this ShortPtr.
      Parameters:
      n - the maximum number of shorts the ShortBuffer can read/write. This will be the ShortBuffer's capacity.
      Returns:
      the ShortBuffer.
    • toShortArray

      public short[] toShortArray​(int n)
      Copies n shorts from the memory pointed to by this ShortPtr to a new short[] instance.
      Parameters:
      n - the number of shorts to copy.
      Returns:
      the short[].
    • get

      public void get​(short[] dst)
      Copies dst.length shorts from the memory pointed to by this ShortPtr to dst.
      Parameters:
      dst - the destination.
    • get

      public void get​(short[] dst, int offset, int count)
      Copies count shorts from the memory pointed to by this ShortPtr to dst starting at offset offset.
      Parameters:
      dst - the destination.
      offset - the offset within the destination array to start copying to.
      count - the number of elements to copy.
    • set

      public void set​(short[] src)
      Copies src.length shorts from src to the memory pointed to by this ShortPtr.
      Parameters:
      src - the source.
    • set

      public void set​(short[] src, int offset, int count)
      Copies count shorts from src starting at offset offset to the memory pointed to by this ShortPtr.
      Parameters:
      src - the source.
      offset - the offset within the source array to start copying from.
      count - the number of elements to copy.