|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Number
jnr.ffi.byref.AbstractNumberReference<Integer>
jnr.ffi.byref.IntByReference
public final class IntByReference
IntByReference is used when the address of a primitive int must be passed as a parameter to a function.
For example, the following C code,
extern void get_a(int * ap); int foo(void) { int 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 IntByReference ap); }
and used like this
IntByReference ap = new IntByReference();
lib.get_a(ap);
System.out.printf("a from lib=%d\n", a.intValue());
| Constructor Summary | |
|---|---|
IntByReference()
Creates a new reference to an integer value initialized to zero. |
|
IntByReference(int value)
Creates a new reference to an integer value |
|
IntByReference(Integer value)
Creates a new reference to an integer value |
|
| Method Summary | |
|---|---|
void |
marshal(Pointer buffer,
long offset)
Copies the integer value to native memory |
int |
nativeSize(Runtime runtime)
Gets the native size of type of reference |
void |
unmarshal(Pointer buffer,
long offset)
Copies the integer value from native memory |
| Methods inherited from class jnr.ffi.byref.AbstractNumberReference |
|---|
byteValue, checkNull, doubleValue, floatValue, getValue, intValue, longValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IntByReference()
public IntByReference(Integer value)
value - the initial native valuepublic IntByReference(int value)
value - the initial native value| Method Detail |
|---|
public void marshal(Pointer buffer,
long offset)
buffer - the native memory buffer
public void unmarshal(Pointer buffer,
long offset)
buffer - the native memory buffer.public int nativeSize(Runtime runtime)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||