Copying a byte buffer with JNI
Posted
by Daniel
on Stack Overflow
See other posts from Stack Overflow
or by Daniel
Published on 2010-02-10T13:40:42Z
Indexed on
2010/03/19
20:51 UTC
Read the original article
Hit count: 245
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?
© Stack Overflow or respective owner