Class FFIUtil

java.lang.Object
org.jruby.ext.ffi.jffi.FFIUtil

public final class FFIUtil extends Object
Some utility functions for FFI <=> jffi conversions
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final com.kenai.jffi.MemoryIO
     
    private static final Map<NativeType,com.kenai.jffi.Type>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static final Map<NativeType,com.kenai.jffi.Type>
     
    private static com.kenai.jffi.Type
     
    (package private) static final com.kenai.jffi.Type
     
    (package private) static final com.kenai.jffi.Type
     
    (package private) static final IRubyObject
    getString(Ruby runtime, long address)
    Reads a nul-terminated string from native memory and boxes it up in a ruby string.
    (package private) static com.kenai.jffi.Array
    newArray(Type.Array arrayType)
    Creates a new JFFI type descriptor for an array
    (package private) static final com.kenai.jffi.Aggregate
    Creates a new JFFI Struct descriptor for a StructLayout

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • IO

      private static final com.kenai.jffi.MemoryIO IO
    • typeMap

      private static final Map<NativeType,com.kenai.jffi.Type> typeMap
  • Constructor Details

    • FFIUtil

      private FFIUtil()
  • Method Details

    • buildTypeMap

      private static final Map<NativeType,com.kenai.jffi.Type> buildTypeMap()
    • getFFIType

      static final com.kenai.jffi.Type getFFIType(Type type)
    • cacheFFIType

      private static com.kenai.jffi.Type cacheFFIType(Type type)
    • getFFIType

      static final com.kenai.jffi.Type getFFIType(NativeType type)
    • newStruct

      static final com.kenai.jffi.Aggregate newStruct(StructLayout layout)
      Creates a new JFFI Struct descriptor for a StructLayout
      Parameters:
      layout - The structure layout
      Returns:
      A new Struct descriptor.
    • newArray

      static com.kenai.jffi.Array newArray(Type.Array arrayType)
      Creates a new JFFI type descriptor for an array
      Parameters:
      arrayType - The structure layout
      Returns:
      A new Struct descriptor.
    • getString

      static final IRubyObject getString(Ruby runtime, long address)
      Reads a nul-terminated string from native memory and boxes it up in a ruby string.
      Parameters:
      runtime - The ruby runtime for the resulting string.
      address - The memory address to read the string from.
      Returns:
      A ruby string.