Top Description Inners Fields Constructors Methods
org.jruby.ext.ffi

public Class Pointer

extends AbstractMemory
Class Inheritance
Known Direct Subclasses
org.jruby.ext.ffi.jffi.DynamicLibrary.Symbol, org.jruby.ext.ffi.AbstractInvoker, org.jruby.ext.ffi.AutoPointer, org.jruby.ext.ffi.MemoryPointer
Annotations
@JRubyClass
name:FFI::Pointer
parent:AbstractMemory
Imports
java.nio.ByteOrder, org.jruby.*, .RubyModule.KindOf, org.jruby.anno.JRubyClass, .JRubyMethod, org.jruby.internal.runtime.methods.DynamicMethod, org.jruby.runtime.*, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.cli.Options

C memory pointer operations.

This is an abstract class that defines Pointer operations

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Inherited from org.jruby.ext.ffi.AbstractMemory:
ABSTRACT_MEMORY_RUBY_CLASSsizetypeSize

Constructor Summary

AccessConstructor and Description
public
Pointer(Ruby runtime, RubyClass klazz)

public
Pointer(Ruby runtime, MemoryIO io)

public
Pointer(Ruby runtime, MemoryIO io, long size, int typeSize)

protected
Pointer(Ruby runtime, RubyClass klass, MemoryIO io)

protected
Pointer(Ruby runtime, RubyClass klass, MemoryIO io, long size)

protected
Pointer(Ruby runtime, RubyClass klass, MemoryIO io, long size, int typeSize)

Method Summary

Modifier and TypeMethod and Description
public IRubyObject
public static RubyClass
createPointerClass(ThreadContext context, RubyModule FFI, RubyClass AbstractMemory)

public final long

Returns:

A long containing the native memory address.
getAddress
()

Gets the native memory address of this pointer.

public static final Pointer
getNull(Ruby runtime)

protected Pointer
getPointer(Ruby runtime, long offset)

Implements abstract org.jruby.ext.ffi.AbstractMemory.getPointer.

public static final RubyClass
public IRubyObject
public IRubyObject
public IRubyObject
initialize_copy(ThreadContext
the thread context
context
,
IRubyObject
the original
other
)

Overrides org.jruby.RubyBasicObject.initialize_copy.

Initializes this object as a copy of the original, that is the parameter to this object.

public IRubyObject

Returns:

true if the address is NULL.
null_p
(ThreadContext
the thread context
context
)

Tests if this Pointer represents the C NULL value.

public IRubyObject
op_equal(ThreadContext context, IRubyObject obj)

Overrides org.jruby.ext.ffi.AbstractMemory.op_equal.

Implements org.jruby.runtime.builtin.IRubyObject.op_equal.

rb_obj_equal Will by default use identity equality to compare objects.

public final AbstractMemory
order(Ruby runtime, ByteOrder order)

Implements abstract org.jruby.ext.ffi.AbstractMemory.order.

public static IRubyObject
protected AbstractMemory
slice(Ruby runtime, long offset)

Implements abstract org.jruby.ext.ffi.AbstractMemory.slice.

protected AbstractMemory
slice(Ruby runtime, long offset, long size)

Implements abstract org.jruby.ext.ffi.AbstractMemory.slice.

public IRubyObject
Inherited from org.jruby.ext.ffi.AbstractMemory:
allocateMemoryIOarefcalculateTypeSizecastcheckArrayclearcreateAbstractMemoryClassequalsgetget_array_of_floatget_array_of_float64get_array_of_int16get_array_of_int32get_array_of_int64get_array_of_int8get_array_of_longget_array_of_pointerget_array_of_stringget_array_of_stringget_array_of_uint16get_array_of_uint32get_array_of_uint64get_array_of_uint8get_array_of_ulongget_bytesget_float32get_float32get_float64get_float64get_int16get_int16get_int32get_int32get_int64get_int64get_int8get_int8get_longget_longget_pointerget_pointerget_stringget_stringget_stringget_uint16get_uint16get_uint32get_uint32get_uint64get_uint64get_uint8get_uint8get_ulongget_ulonggetOffsetgetSizehashhashCodeop_plusorderorderputput_array_of_floatput_array_of_float64put_array_of_int16put_array_of_int32put_array_of_int64put_array_of_int8put_array_of_longput_array_of_pointerput_array_of_uint16put_array_of_uint32put_array_of_uint64put_array_of_uint8put_array_of_ulongput_bytesput_callbackput_float32put_float32put_float64put_float64put_int16put_int16put_int32put_int32put_int64put_int64put_int8put_int8put_longput_longput_pointerput_pointerput_stringput_uint16put_uint16put_uint32put_uint32put_uint64put_uint64put_uint8put_uint8put_ulongput_ulongread_array_of_floatread_array_of_float64read_array_of_int16read_array_of_int32read_array_of_int64read_array_of_int8read_array_of_longread_array_of_pointerread_array_of_stringread_array_of_stringread_array_of_typeread_array_of_typeread_array_of_uint16read_array_of_uint32read_array_of_uint64read_array_of_uint8read_array_of_ulongread_bytesread_charread_doubleread_floatread_intread_longread_long_longread_pointerread_shortread_stringread_stringread_ucharread_uintread_uint16read_uint8read_ulongread_ulong_longread_ushortsliceto_ptrtotaltype_sizewrite_array_of_floatwrite_array_of_float64write_array_of_int16write_array_of_int32write_array_of_int64write_array_of_int8write_array_of_longwrite_array_of_pointerwrite_array_of_typewrite_array_of_typewrite_array_of_uint16write_array_of_uint32write_array_of_uint64write_array_of_uint8write_array_of_ulongwrite_byteswrite_charwrite_doublewrite_floatwrite_intwrite_longwrite_long_longwrite_pointerwrite_shortwrite_stringwrite_stringwrite_ucharwrite_uintwrite_ulong_longwrite_ushort

Constructor Detail

Pointerback to summary
public Pointer(Ruby runtime, RubyClass klazz)
Pointerback to summary
public Pointer(Ruby runtime, MemoryIO io)
Pointerback to summary
public Pointer(Ruby runtime, MemoryIO io, long size, int typeSize)
Pointerback to summary
protected Pointer(Ruby runtime, RubyClass klass, MemoryIO io)
Pointerback to summary
protected Pointer(Ruby runtime, RubyClass klass, MemoryIO io, long size)
Pointerback to summary
protected Pointer(Ruby runtime, RubyClass klass, MemoryIO io, long size, int typeSize)

Method Detail

addressback to summary
public IRubyObject address(ThreadContext context)
Annotations
@JRubyMethod
name:address, to_i
createPointerClassback to summary
public static RubyClass createPointerClass(ThreadContext context, RubyModule FFI, RubyClass AbstractMemory)
getAddressback to summary
public final long getAddress()

Gets the native memory address of this pointer.

Returns:long

A long containing the native memory address.

getNullback to summary
public static final Pointer getNull(Ruby runtime)
getPointerback to summary
protected Pointer getPointer(Ruby runtime, long offset)

Implements abstract org.jruby.ext.ffi.AbstractMemory.getPointer.

getPointerClassback to summary
public static final RubyClass getPointerClass(Ruby runtime)
initializeback to summary
public IRubyObject initialize(ThreadContext context, IRubyObject address)
Annotations
@JRubyMethod
name:initialize
visibility:PRIVATE
initializeback to summary
public IRubyObject initialize(ThreadContext context, IRubyObject type, IRubyObject address)
Annotations
@JRubyMethod
name:initialize
visibility:PRIVATE
initialize_copyback to summary
public IRubyObject initialize_copy(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyBasicObject.initialize_copy.

Doc from org.jruby.RubyBasicObject.initialize_copy.

Initializes this object as a copy of the original, that is the parameter to this object. Will make sure that the argument actually has the same real class as this object. It shouldn't be possible to initialize an object with something totally different.

Parameters
context:ThreadContext

the thread context

other:IRubyObject

the original

Returns:IRubyObject

a copy unless the same thing

Annotations
@JRubyMethod
required:1
visibility:PRIVATE
null_pback to summary
public IRubyObject null_p(ThreadContext context)

Tests if this Pointer represents the C NULL value.

Parameters
context:ThreadContext

the thread context

Returns:IRubyObject

true if the address is NULL.

Annotations
@JRubyMethod
name:null?
op_equalback to summary
public IRubyObject op_equal(ThreadContext context, IRubyObject obj)

Overrides org.jruby.ext.ffi.AbstractMemory.op_equal.

Implements org.jruby.runtime.builtin.IRubyObject.op_equal.

Doc from org.jruby.RubyBasicObject.op_equal.

rb_obj_equal Will by default use identity equality to compare objects. This follows the Ruby semantics. The name of this method doesn't follow the convention because hierarchy problems

Annotations
@JRubyMethod
name:==
orderback to summary
public final AbstractMemory order(Ruby runtime, ByteOrder order)

Implements abstract org.jruby.ext.ffi.AbstractMemory.order.

sizeback to summary
public static IRubyObject size(ThreadContext context, IRubyObject recv)
Annotations
@JRubyMethod
name:size
meta:true
visibility:PUBLIC
sliceback to summary
protected AbstractMemory slice(Ruby runtime, long offset)

Implements abstract org.jruby.ext.ffi.AbstractMemory.slice.

Annotations
@Override
sliceback to summary
protected AbstractMemory slice(Ruby runtime, long offset, long size)

Implements abstract org.jruby.ext.ffi.AbstractMemory.slice.

Annotations
@Override
to_sback to summary
public IRubyObject to_s(ThreadContext context)

Overrides org.jruby.RubyBasicObject.to_s.

Annotations
@JRubyMethod
name:to_s, inspect
org.jruby.ext.ffi back to summary

private final Class Pointer.NilToPointerMethod

extends DynamicMethod
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final Arity
private final Pointer
Inherited from org.jruby.internal.runtime.methods.DynamicMethod:
aliasCountdefinedClassflagshandleimplementationClassnameprotectedClassserialNumber

Constructor Summary

AccessConstructor and Description
private
NilToPointerMethod(RubyModule implementationClass, Pointer nullPointer, String name)

Method Summary

Modifier and TypeMethod and Description
public IRubyObject
call(ThreadContext
The thread context for the currently executing thread
context
,
IRubyObject
The 'self' or 'receiver' object to use for this call
self
,
RubyModule
The Ruby class against which this method is binding
clazz
,
String
The incoming name used to invoke this method
name
,
IRubyObject[]
The argument list to this invocation
args
,
Block
The block passed to this invocation
block
)

Implements abstract org.jruby.internal.runtime.methods.DynamicMethod.call.

The minimum 'call' method required for a dynamic method handle.

public IRubyObject
public DynamicMethod
dup()

Implements abstract org.jruby.internal.runtime.methods.DynamicMethod.dup.

Duplicate this method, returning DynamicMethod referencing the same code and with the same attributes.

Inherited from org.jruby.internal.runtime.methods.DynamicMethod:
adjustAliasCountcalculateProtectedClasscallcallcallcallcallcallcallcallcallRespondTogetAliasCountgetAritygetCallConfiggetDefinedClassgetHandlegetImplementationClassgetInstanceVariableNamesgetMethodDatagetNamegetProtectedClassgetRealMethodgetSerialNumbergetSignaturegetVisibilityinitinitisBuiltinisCallableFromisImplementedByisNativeisNotImplementedisNullisRefinedisUndefinedsetCallConfigsetDefinedClasssetHandlesetImplementationClasssetIsBuiltinsetNotImplementedsetRuby2KeywordssetVisibility

Field Detail

ARITYback to summary
private static final Arity ARITY
nullPointerback to summary
private final Pointer nullPointer

Constructor Detail

NilToPointerMethodback to summary
private NilToPointerMethod(RubyModule implementationClass, Pointer nullPointer, String name)

Method Detail

callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block)

Implements abstract org.jruby.internal.runtime.methods.DynamicMethod.call.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.call.

The minimum 'call' method required for a dynamic method handle. Subclasses must implement this method, but may implement the other signatures to provide faster, non-boxing call paths. Typically subclasses will implement this method to check variable arity calls, then performing a specific-arity invocation to the appropriate method or performing variable-arity logic in-line.

Parameters
context:ThreadContext

The thread context for the currently executing thread

self:IRubyObject

The 'self' or 'receiver' object to use for this call

clazz:RubyModule

The Ruby class against which this method is binding

name:String

The incoming name used to invoke this method

args:IRubyObject[]

The argument list to this invocation

block:Block

The block passed to this invocation

Returns:IRubyObject

The result of the call

Annotations
@Override
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

Annotations
@Override
dupback to summary
public DynamicMethod dup()

Implements abstract org.jruby.internal.runtime.methods.DynamicMethod.dup.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.dup.

Duplicate this method, returning DynamicMethod referencing the same code and with the same attributes. It is not required that this method produce a new object if the semantics of the DynamicMethod subtype do not require such.

Returns:DynamicMethod

An identical DynamicMethod object to the target.

Annotations
@Override