Package jnr.ffi

Class Struct.StructRef<T extends Struct>

Type Parameters:
T - - Struct type
Enclosing class:
Struct

public class Struct.StructRef<T extends Struct> extends Struct.PointerField
Represents a reference to a Struct or and array of Structs
  • Constructor Details

    • StructRef

      public StructRef(Class<T> structType)
    • StructRef

      public StructRef(Class<T> structType, int initialStructCount)
      Parameters:
      structType - Struct type
      initialStructCount - the number of struct instances. Use this to allocate memory without setting value.
    • StructRef

      public StructRef(Struct.Offset offset, Class<T> structType)
    • StructRef

      public StructRef(Struct.Offset offset, Class<T> structType, int initialStructCount)
      Parameters:
      offset - offset of the field
      structType - Struct type
      initialStructCount - the number of struct instances. Use this to allocate memory without setting value.
  • Method Details

    • set

      public final void set(T struct)
    • set

      public final void set(T[] structs)
    • get

      public final T get()
      Returns:
      struct from memory
    • get

      public final T[] get(int length)
      Parameters:
      length - the length of struct in memory to get
      Returns:
      struct from memory
    • toString

      public String toString()
      Description copied from class: Struct.PointerField
      Returns a string representation of this Pointer.
      Overrides:
      toString in class Struct.PointerField
      Returns:
      a string representation of this Pointer.