public final class IntByReference extends AbstractNumberReference<Integer>
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 and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
void |
fromNative(Runtime runtime,
Pointer buffer,
long offset)
Copies the integer value from native memory
|
int |
nativeSize(Runtime runtime)
Gets the native size of type of reference
|
void |
toNative(Runtime runtime,
Pointer buffer,
long offset)
Copies the integer value to native memory
|
byteValue, checkNull, doubleValue, floatValue, getValue, intValue, longValue, shortValue
public IntByReference()
public IntByReference(Integer value)
value
- the initial native valuepublic IntByReference(int value)
value
- the initial native valuepublic void toNative(Runtime runtime, Pointer buffer, long offset)
runtime
- the current runtime.buffer
- the native memory buffer.offset
- the memory offset.public void fromNative(Runtime runtime, Pointer buffer, long offset)
runtime
- the current runtime.buffer
- the native memory buffer.offset
- the memory offset.public int nativeSize(Runtime runtime)
runtime
- The current runtime.Copyright © 2017. All rights reserved.