Class LongPtr

All Implemented Interfaces:
Iterable<LongPtr>

public final class LongPtr
extends Struct<LongPtr>
Points to a 64-bit signed value (int64_t * in C).
  • Constructor Details

    • LongPtr

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

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

    • get

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

      public void set​(long value)
      Sets the value.
      Parameters:
      value - the new value.
    • asLongBuffer

      public LongBuffer asLongBuffer​(int n)
      Returns a LongBuffer which reads and writes to the same memory location pointed to by this LongPtr.
      Parameters:
      n - the maximum number of longs the LongBuffer can read/write. This will be the LongBuffer's capacity.
      Returns:
      the LongBuffer.
    • toLongArray

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

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

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

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