Top Description Fields Constructors Methods
jnr.ffi.byref

public final Class ByteByReference

extends AbstractNumberReference<Byte>
Class Inheritance
Imports
jnr.ffi.Pointer, .Runtime

ByteByReference is used when the address of a primitive byte value must be passed as a parameter to a function.

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());

Field Summary

Inherited from jnr.ffi.byref.AbstractNumberReference:
value

Constructor Summary

AccessConstructor and Description
public
ByteByReference()

Creates a new reference to a byte value initialized to zero.

public
ByteByReference(Byte
the initial native value
value
)

Creates a new reference to a byte value

public
ByteByReference(byte
the initial native value
value
)

Creates a new reference to a byte value

Method Summary

Modifier and TypeMethod and Description
public void
fromNative(Runtime
The current runtime.
runtime
,
Pointer
the native memory buffer.
buffer
,
long
The offset of the field.
offset
)

Implements jnr.ffi.byref.ByReference.fromNative.

Copies the Byte value from native memory
public final int

Returns:

the size of a byte in bytes
nativeSize
(Runtime
The current runtime.
runtime
)

Implements jnr.ffi.byref.ByReference.nativeSize.

Gets the native size of type of reference in bytes.
public void
toNative(Runtime
The current runtime.
runtime
,
Pointer
the native memory buffer
buffer
,
long
The offset of the field.
offset
)

Implements jnr.ffi.byref.ByReference.toNative.

Copies the Byte value to native memory
Inherited from jnr.ffi.byref.AbstractNumberReference:
byteValuecheckNulldoubleValuefloatValuegetValueintValuelongValueshortValue

Constructor Detail

ByteByReferenceback to summary
public ByteByReference()

Creates a new reference to a byte value initialized to zero.

ByteByReferenceback to summary
public ByteByReference(Byte value)

Creates a new reference to a byte value

Parameters
value:Byte

the initial native value

ByteByReferenceback to summary
public ByteByReference(byte value)

Creates a new reference to a byte value

Parameters
value:byte

the initial native value

Method Detail

fromNativeback to summary
public void fromNative(Runtime runtime, Pointer buffer, long offset)

Implements jnr.ffi.byref.ByReference.fromNative.

Copies the Byte value from native memory

Parameters
runtime:Runtime

The current runtime.

buffer:Pointer

the native memory buffer.

offset:long

Doc from jnr.ffi.byref.ByReference.fromNative.

The offset of the field.

nativeSizeback to summary
public final int nativeSize(Runtime runtime)

Implements jnr.ffi.byref.ByReference.nativeSize.

Gets the native size of type of reference in bytes.

Parameters
runtime:Runtime

Doc from jnr.ffi.byref.ByReference.nativeSize.

The current runtime.

Returns:int

the size of a byte in bytes

toNativeback to summary
public void toNative(Runtime runtime, Pointer buffer, long offset)

Implements jnr.ffi.byref.ByReference.toNative.

Copies the Byte value to native memory

Parameters
runtime:Runtime

The current runtime.

buffer:Pointer

the native memory buffer

offset:long

Doc from jnr.ffi.byref.ByReference.toNative.

The offset of the field.