Package jnr.ffi

Class StructLayout

java.lang.Object
jnr.ffi.Type
jnr.ffi.StructLayout

public class StructLayout extends Type
  • Field Details

    • ASCII

      static final Charset ASCII
    • UTF8

      static final Charset UTF8
    • runtime

      private final Runtime runtime
    • isUnion

      private final boolean isUnion
      See Also:
    • resetIndex

      private boolean resetIndex
    • enclosing

      StructLayout enclosing
    • offset

      int offset
    • size

      int size
    • alignment

      int alignment
    • paddedSize

      int paddedSize
  • Constructor Details

    • StructLayout

      protected StructLayout(Runtime runtime)
      Creates a new StructLayout.
      Parameters:
      runtime - The current runtime.
    • StructLayout

      protected StructLayout(Runtime runtime, int structSize)
  • Method Details

    • getRuntime

      public final Runtime getRuntime()
    • size

      public final int size()
      Description copied from class: Type
      The size in bytes of this type.
      Specified by:
      size in class Type
      Returns:
      An integer
    • alignment

      public final int alignment()
      Description copied from class: Type
      The native alignment of this type, in bytes
      Specified by:
      alignment in class Type
      Returns:
      An integer
    • offset

      public final int offset()
    • getNativeType

      public NativeType getNativeType()
      Description copied from class: Type
      The native type of this type
      Specified by:
      getNativeType in class Type
      Returns:
      the native type of this type
    • toString

      public String toString()
      Returns a human readable String representation of the structure.
      Overrides:
      toString in class Object
      Returns:
      a String representation of this structure.
    • align

      private static int align(int offset, int alignment)
    • addField

      protected final int addField(int size, int align)
    • addField

      protected final int addField(int size, int align, StructLayout.Offset offset)
    • addField

      protected final int addField(Type t)
    • addField

      protected final int addField(Type t, StructLayout.Offset offset)
    • at

      protected final StructLayout.Offset at(int offset)
    • arrayBegin

      protected final void arrayBegin()
      Starts an array construction session
    • arrayEnd

      protected final void arrayEnd()
      Ends an array construction session
    • array

      protected <T extends StructLayout.Field> T[] array(T[] array)
      Creates an array of Member instances.
      Type Parameters:
      T - The type of the Member subclass to create.
      Parameters:
      array - the array to store the instances in
      Returns:
      the array that was passed in
    • inner

      protected final <T extends StructLayout> T inner(T structLayout)
    • function

      protected final <T> StructLayout.Function<T> function(Class<T> closureClass)
    • function

      protected final <T> StructLayout.Function<T> function(Class<T> closureClass, StructLayout.Offset offset)