Class IntPtr

All Implemented Interfaces:
Iterable<IntPtr>

public final class IntPtr
extends Struct<IntPtr>
Points to a 32-bit signed value (int32_t * in C).
  • Constructor Details

    • IntPtr

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

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

    • get

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

      public void set​(int value)
      Sets the value.
      Parameters:
      value - the new value.
    • asIntBuffer

      public IntBuffer asIntBuffer​(int n)
      Returns a IntBuffer which reads and writes to the same memory location pointed to by this IntPtr.
      Parameters:
      n - the maximum number of ints the IntBuffer can read/write. This will be the IntBuffer's capacity.
      Returns:
      the IntBuffer.
    • toIntArray

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

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

      public void get​(int[] dst, int offset, int count)
      Copies count ints from the memory pointed to by this IntPtr 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​(int[] src)
      Copies src.length ints from src to the memory pointed to by this IntPtr.
      Parameters:
      src - the source.
    • set

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