Access pointer to java buffer array - forcing GetByteArrayElements NOT to c
Hello,
I need to pass a Big binary data from java through JNI to a device driver.
If I directly use the dll and create an application, then data transfer is 2Mbps. But if I use JNI and transfer data from java, speed is 100Kbps.
SO there is a bottleneck in JNI.
When i tried the function GetByteArrayElements, it is always creating a copy of the big memory before transfering each block. This could be a potential reason for this.
jboolean *isCopy;
char* cTxbuffer = (char *)(env)->GetByteArrayElements(txbuffer,isCopy);
if(*isCopy == JNI_TRUE)
cout<<"ISCOPY"; // code executes here
else
cout<<"ISNOTCOPY";
My JVM always crestes a copy for the same.
So my questions.
1) Can anybody a suggest a function to directly get the pointer in JNI to java byte array created in java?
2) Can I force GetByteArrayElements NOT to create a copy?
Sugestions and ides are welcome.
thank you,
Boby Thomas

