Problems using DirectByteBuffer

Joined
Aug 28, 2009
Messages
2
Reaction score
0
I am passing a DirectByteBuffer from my C code to java code in parameter of java function that I am calling.

Here is what I am doing:

Code:
jobject j_data = (*env)->(*env)->NewDirectByteBuffer(env, data, len);
(*env)->CallStaticVoidMethod(env, j_class, j_method_id, j_data);

But I am getting UnsupportedOperationException on java side when I do byteBuffer.array().

I checked the address of the data that I am giving to direct byte buffer and its a valid address.

Is there anything I am missing?
 

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,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top