tags:

views:

52

answers:

1

I am trying to use JNI to process large chunks of data using C++ however I am having trouble understanding weather the function SetArrayRegion will duplicate an array element by element or if it can just leave the data in place and return it to the calling java function.

The following documentation is where I have been reading about it but it is still unclear what is going on. http://download.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html

Thank you for the help.

A: 

Generally when you pass data via JNI it will be copied across the JNI boundary. If you want an efficient mechanism for passing data from native space up to Java space then you should look at how to access NIO direct byte buffers. This can provide a section of memory that can be shared between native code and Java code. Look at GetDirectBufferAddress.

Michael Barker
Thank you, I believe that is the function I was looking for.
FearTheCron