Class MemoryUtil

java.lang.Object
org.jruby.ext.ffi.MemoryUtil

public final class MemoryUtil extends Object
  • Method Details

    • getArrayOfSigned8

      public static IRubyObject getArrayOfSigned8(ThreadContext context, MemoryIO io, long offset, int count)
    • putArrayOfSigned8

      public static void putArrayOfSigned8(MemoryIO io, long offset, RubyArray ary)
    • getArrayOfUnsigned8

      public static IRubyObject getArrayOfUnsigned8(ThreadContext context, MemoryIO io, long offset, int count)
    • putArrayOfUnsigned8

      public static void putArrayOfUnsigned8(MemoryIO io, long offset, RubyArray ary)
    • getArrayOfSigned16

      public static IRubyObject getArrayOfSigned16(ThreadContext context, MemoryIO io, long offset, int count)
    • putArrayOfSigned16

      public static void putArrayOfSigned16(MemoryIO io, long offset, RubyArray ary)
    • getArrayOfUnsigned16

      public static IRubyObject getArrayOfUnsigned16(ThreadContext context, MemoryIO io, long offset, int count)
    • putArrayOfUnsigned16

      public static void putArrayOfUnsigned16(MemoryIO io, long offset, RubyArray ary)
    • getArrayOfSigned32

      public static IRubyObject getArrayOfSigned32(ThreadContext context, MemoryIO io, long offset, int count)
    • putArrayOfSigned32

      public static void putArrayOfSigned32(MemoryIO io, long offset, RubyArray ary)
    • getArrayOfUnsigned32

      public static IRubyObject getArrayOfUnsigned32(ThreadContext context, MemoryIO io, long offset, int count)
    • putArrayOfUnsigned32

      public static void putArrayOfUnsigned32(MemoryIO io, long offset, RubyArray ary)
    • getArrayOfSigned64

      public static IRubyObject getArrayOfSigned64(ThreadContext context, MemoryIO io, long offset, int count)
    • putArrayOfSigned64

      public static void putArrayOfSigned64(MemoryIO io, long offset, RubyArray ary)
    • getArrayOfUnsigned64

      public static IRubyObject getArrayOfUnsigned64(ThreadContext context, MemoryIO io, long offset, int count)
    • putArrayOfUnsigned64

      public static void putArrayOfUnsigned64(MemoryIO io, long offset, RubyArray ary)
    • getArrayOfFloat32

      public static IRubyObject getArrayOfFloat32(ThreadContext context, MemoryIO io, long offset, int count)
    • putArrayOfFloat32

      @Deprecated(since="10.0") public static void putArrayOfFloat32(MemoryIO io, long offset, RubyArray ary)
      Deprecated.
    • putArrayOfFloat32

      public static void putArrayOfFloat32(ThreadContext context, MemoryIO io, long offset, RubyArray ary)
    • getArrayOfFloat64

      public static IRubyObject getArrayOfFloat64(ThreadContext context, MemoryIO io, long offset, int count)
    • putArrayOfFloat64

      @Deprecated(since="10.0") public static void putArrayOfFloat64(MemoryIO io, long offset, RubyArray ary)
      Deprecated.
    • putArrayOfFloat64

      public static void putArrayOfFloat64(ThreadContext context, MemoryIO io, long offset, RubyArray ary)
    • newTaintedString

      public static RubyString newTaintedString(Ruby runtime, byte[] bytes)
      Creates a ruby string from a byte array
      Parameters:
      runtime - The ruby runtime
      bytes - The array to make into a ruby string.
      Returns:
      A ruby string.
    • getTaintedByteString

      public static RubyString getTaintedByteString(Ruby runtime, MemoryIO io, long offset, int length)
      Reads a byte (binary) string from a memory object.
      Parameters:
      runtime - The ruby runtime
      io - The memory object to read the string from
      offset - The offset within the memory object to start reading
      length - The number of bytes to read
      Returns:
      A ruby string
    • getTaintedString

      public static IRubyObject getTaintedString(Ruby runtime, MemoryIO io, long offset)
      Gets a NUL terminated string from a memory object
      Parameters:
      runtime - The ruby runtime
      io - The memory object to read the string from
      offset - The offset within the memory object to start reading
      Returns:
      A ruby string
    • getTaintedString

      public static IRubyObject getTaintedString(Ruby runtime, MemoryIO io, long offset, int length)
      Reads a NUL terminated string from a memory object
      Parameters:
      runtime - The ruby runtime
      io - The memory object to read the string from
      offset - The offset within the memory object to start reading
      length - The maximum number of bytes to read
      Returns:
      A ruby string