How to pass and receive objects using JNI

落花浮王杯 提交于 2019-12-06 03:03:28

Both GetByteArrayRegion() and SetByteArrayRegion() can throw ArrayIndexOutOfBoundsException if the specified region goes outside the bounds of the array.

Your call to SetByteArrayRegion() looks correct -- it immediately follows creation of the array of the required size.

Verify that the size of the array on entry, accessed by GetByteArrayRegion(), is at least FP_PRINT_DATA_DATA_SIZE.

By the way, an alternative is to use GetByteArrayElements() and ReleaseByteArrayElements(), which may return a pointer to the same memory Java uses for the Array.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!