GetByteArrayElements何时返回null

When does GetByteArrayElements return null?

本文关键字:null 返回 何时 GetByteArrayElements      更新时间:2023-10-16

我正在使用JNI/NDK将一些C++库与Android应用程序绑定。其中一个Java方法使用字节数组,因此我需要在JNI绑定中调用GetByteArrayElements。在什么情况下GetByteArrayElements返回NULL?Oracle的文档简单地说明:

Returns a pointer to the array elements, or NULL if the operation fails.

哪些情况会导致操作失败并返回NULL?

如果操作失败,它将返回NULL,否则不会返回,包括空数组的情况。