public final class PointerByReference extends AbstractReference<Pointer>
For example, the following C code,
extern void get_a(void** ap); void* foo(void) { void* a; // pass a reference to 'a' so get_a() can fill it out get_a(&a); return a; }
Would be declared in java as
interface Lib { void get_a(@Out PointerByReference ap); }
and used like this
PointerByReference ap = new PointerByReference();
lib.get_a(ap);
Pointer ptr = ap.getValue();
System.out.println("ptr from lib=" + a.getValue());
System.out.println("ptr contents=" + ptr.getInt(0));
| Constructor and Description |
|---|
PointerByReference()
Creates a new reference to a pointer value with a null default value.
|
PointerByReference(Pointer value)
Creates a new reference to a pointer value
|
| Modifier and Type | Method and Description |
|---|---|
void |
fromNative(Runtime runtime,
Pointer memory,
long offset)
Copies the java value from native memory
|
int |
nativeSize(Runtime runtime)
Gets the size of the native buffer required to store the value
|
void |
toNative(Runtime runtime,
Pointer memory,
long offset)
Copies the java value to native memory
|
checkNull, getValuepublic PointerByReference()
public PointerByReference(Pointer value)
value - the initial pointer valuepublic final void toNative(Runtime runtime, Pointer memory, long offset)
ByReferencememory - the native memory buffer.public final void fromNative(Runtime runtime, Pointer memory, long offset)
ByReferencememory - the native memory buffer.public final int nativeSize(Runtime runtime)
ByReferenceCopyright © 2013. All rights reserved.