public final class NativeLongByReference extends AbstractNumberReference<NativeLong>
For example, the following C code,
extern void get_a(long * ap);
long foo(void) {
long 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 NativeLongByReference ap);
}
and used like this
NativeLongByReference ap = new NativeLongByReference(); lib.get_a(ap); System.out.printf("a from lib=%d\n", a.longValue());
Constructor and Description |
---|
NativeLongByReference()
Creates a new reference to a native long value initialized to zero.
|
NativeLongByReference(long value)
Creates a new reference to a native long value
|
NativeLongByReference(NativeLong value)
Creates a new reference to a native long value
|
Modifier and Type | Method and Description |
---|---|
void |
fromNative(Runtime runtime,
Pointer memory,
long offset)
Copies the long value from native memory
|
int |
nativeSize(Runtime runtime)
Gets the native size of type of reference in bytes.
|
void |
toNative(Runtime runtime,
Pointer memory,
long offset)
Copies the long value to native memory
|
byteValue, checkNull, doubleValue, floatValue, getValue, intValue, longValue, shortValue
public NativeLongByReference()
public NativeLongByReference(NativeLong value)
value
- the initial native valuepublic NativeLongByReference(long value)
value
- the initial native valuepublic void toNative(Runtime runtime, Pointer memory, long offset)
runtime
- the current runtime.memory
- the native memory buffer.offset
- the memory offset.public void fromNative(Runtime runtime, Pointer memory, long offset)
runtime
- the current runtime.memory
- the native memory buffer.offset
- the memory offset.public final int nativeSize(Runtime runtime)
runtime
- the current runtime.Copyright © 2017. All rights reserved.