Copying a byte buffer with JNI
- by Daniel
I've found plenty of tutorials / questions on Stackoverflow that deal with copying char arrays from C/JNI side into something like a byte[] in Java, but not the other way around.
I am using a native C library which expects a byte array. I simply want to get data from a byte[] in java, into preferably an unsigned char[] in C.
Long story short: What is the best way of copying data from a jBytearray in JNI? Is there any way to detect it's size?