我需要从 JNI 调用的 java 方法中传递一个数组和一个整数。
public static int foo(byte[] data)
{
byte[] buffer;
// Fill buffer with data
data = buffer; // <--- This doesn't work as the pointer is changed
return bufferSize;
}
在指示的行中,我的理解是指针已更改,但我在 JNI 中data
传入的引用没有更新,因此我没有获得新数据。
我将如何通过参数返回额外的数据?