Class NkMemory

All Implemented Interfaces:
Pointer

public class NkMemory extends Struct<NkMemory>

 struct nk_memory {
     void * ptr;
     nk_size size;
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • PTR

      public static final int PTR
      The struct member offsets.
    • SIZE

      public static final int SIZE
      The struct member offsets.
  • Constructor Details

    • NkMemory

      public NkMemory(ByteBuffer container)
      Creates a NkMemory instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<NkMemory>
    • ptr

      public @Nullable ByteBuffer ptr()
      Returns:
      a ByteBuffer view of the data pointed to by the ptr field.
    • size

      public long size()
      Returns:
      the value of the size field.
    • create

      public static NkMemory create(long address)
      Returns a new NkMemory instance for the specified memory address.
    • createSafe

      public static @Nullable NkMemory createSafe(long address)
      Like create, but returns null if address is NULL.
    • create

      public static NkMemory.Buffer create(long address, int capacity)
      Create a NkMemory.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable NkMemory.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • nptr

      public static @Nullable ByteBuffer nptr(long struct)
      Unsafe version of ptr.
    • nsize

      public static long nsize(long struct)
      Unsafe version of size().