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