converting jbytearray to unsigned char array

M

marydeepthy

Hi,

i have a native method, as folowws:

JNIEXPORT jobjectArray JNICALL l2cap_L2CAPImpl_L2CAOpen
(JNIEnv *env, jobject obj, jbyteArray dev, jstring service, jboolean
auth, jboolean crypt)
{
unsigned char address[6];

}


the value of address is the same as jbyteArray dev, which is passed
from the java program. i have to convert the jbytearray to this char
array. how can i do this. i am completely new to JNI and this native
calls are only a small part of my big project..so please do help me...
 
J

Joan

Hi,

i have a native method, as folowws:

JNIEXPORT jobjectArray JNICALL l2cap_L2CAPImpl_L2CAOpen
(JNIEnv *env, jobject obj, jbyteArray dev, jstring service,
jboolean
auth, jboolean crypt)
{
unsigned char address[6];

}


the value of address is the same as jbyteArray dev, which is
passed
from the java program. i have to convert the jbytearray to this
char
array. how can i do this. i am completely new to JNI and this
native
calls are only a small part of my big project..so please do
help me...
SUN has a tutorial on this, take a look.
 
G

Gordon Beaton

i have to convert the jbytearray to this char array. how can i do
this.

GetByteArrayElements() and (important!) ReleaseByteArrayElements().

These and other functions are described in the Array Operations
section of the JNI spec.

/gordon
 
B

Boudewijn Dijkstra

Roedy Green said:
I suggest getting a text book to explain these. Understanding them
from the raw spec are for the types who like to eat nails for
breakfast.

Hmm, sounds like I should try eating nails for breakfast.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top