Class CharPtr

All Implemented Interfaces:
Iterable<CharPtr>

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

    • CharPtr

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

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

    • get

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

      public void set​(char value)
      Sets the value.
      Parameters:
      value - the new value.
    • asCharBuffer

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

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

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

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

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