| 64 | } |
| 65 | |
| 66 | void StringToJByteArray(JNIEnv* env, const std::string& str, jbyteArray* jbarray) { |
| 67 | size_t str_len = str.size(); |
| 68 | *jbarray = env->NewByteArray(str_len); |
| 69 | jbyte* buffer = env->GetByteArrayElements(*jbarray, 0); |
| 70 | memcpy(buffer, str.data(), str_len); |
| 71 | env->SetByteArrayRegion(*jbarray, 0, str_len, buffer); |
| 72 | } |
no test coverage detected