Home | History | Annotate | Download | only in jni

Lines Matching refs:env

30         JNIEnv *env, jobjectArray keys, jobjectArray values,
36 nKeyValuePairs = env->GetArrayLength(keys);
37 failed = (nKeyValuePairs != env->GetArrayLength(values));
47 jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
54 jstring key = (jstring) env->GetObjectArrayElement(keys, i);
55 jstring value = (jstring) env->GetObjectArrayElement(values, i);
57 const char* keyStr = env->GetStringUTFChars(key, NULL);
62 const char* valueStr = env->GetStringUTFChars(value, NULL);
64 env->ReleaseStringUTFChars(key, keyStr);
70 env->ReleaseStringUTFChars(key, keyStr);
71 env->ReleaseStringUTFChars(value, valueStr);
72 env->DeleteLocalRef(key);
73 env->DeleteLocalRef(value);
78 static jobject makeIntegerObject(JNIEnv *env, int32_t value) {
79 jclass clazz = env->FindClass("java/lang/Integer");
82 jmethodID integerConstructID = env->GetMethodID(clazz, "<init>", "(I)V");
85 return env->NewObject(clazz, integerConstructID, value);
88 static jobject makeLongObject(JNIEnv *env, int64_t value) {
89 jclass clazz = env->FindClass("java/lang/Long");
92 jmethodID longConstructID = env->GetMethodID(clazz, "<init>", "(J)V");
95 return env->NewObject(clazz, longConstructID, value);
98 static jobject makeFloatObject(JNIEnv *env, float value) {
99 jclass clazz = env->FindClass("java/lang/Float");
102 jmethodID floatConstructID = env->GetMethodID(clazz, "<init>", "(F)V");
105 return env->NewObject(clazz, floatConstructID, value);
109 JNIEnv *env, const void *data, size_t size) {
110 jbyteArray byteArrayObj = env->NewByteArray(size);
111 env->SetByteArrayRegion(byteArrayObj, 0, size, (const jbyte *)data);
113 jclass clazz = env->FindClass("java/nio/ByteBuffer");
117 env->GetStaticMethodID(clazz, "wrap", "([B)Ljava/nio/ByteBuffer;");
120 jobject byteBufObj = env->CallStaticObjectMethod(
123 env->DeleteLocalRef(byteArrayObj); byteArrayObj = NULL;
129 JNIEnv *env, jobject hashMapObj, jmethodID hashMapPutID,
131 jstring keyObj = env->NewStringUTF(key);
132 jobject valueObj = makeIntegerObject(env, value);
134 jobject res = env->CallObjectMethod(
137 env->DeleteLocalRef(valueObj); valueObj = NULL;
138 env->DeleteLocalRef(keyObj); keyObj = NULL;
142 JNIEnv *env, const sp<AMessage> &msg, jobject *map) {
143 jclass hashMapClazz = env->FindClass("java/util/HashMap");
150 env->GetMethodID(hashMapClazz, "<init>", "()V");
157 env->GetMethodID(
166 jobject hashMap = env->NewObject(hashMapClazz, hashMapConstructID);
180 valueObj = makeIntegerObject(env, val);
189 valueObj = makeLongObject(env, val);
198 valueObj = makeFloatObject(env, val);
207 valueObj = env->NewStringUTF(val.c_str());
217 env, buffer->data(), buffer->size());
227 env,
234 env,
241 env,
248 env,
261 jstring keyObj = env->NewStringUTF(key);
263 jobject res = env->CallObjectMethod(
266 env->DeleteLocalRef(keyObj); keyObj = NULL;
267 env->DeleteLocalRef(valueObj); valueObj = NULL;
277 JNIEnv *env, jobjectArray keys, jobjectArray values,
279 jclass stringClass = env->FindClass("java/lang/String");
282 jclass integerClass = env->FindClass("java/lang/Integer");
285 jclass floatClass = env->FindClass("java/lang/Float");
288 jclass byteBufClass = env->FindClass("java/nio/ByteBuffer");
300 numEntries = env->GetArrayLength(keys);
302 if (numEntries != env->GetArrayLength(values)) {
310 jobject keyObj = env->GetObjectArrayElement(keys, i);
312 if (!env->IsInstanceOf(keyObj, stringClass)) {
316 const char *tmp = env->GetStringUTFChars((jstring)keyObj, NULL);
324 env->ReleaseStringUTFChars((jstring)keyObj, tmp);
327 jobject valueObj = env->GetObjectArrayElement(values, i);
329 if (env->IsInstanceOf(valueObj, stringClass)) {
330 const char *value = env->GetStringUTFChars((jstring)valueObj, NULL);
338 env->ReleaseStringUTFChars((jstring)valueObj, value);
340 } else if (env->IsInstanceOf(valueObj, integerClass)) {
342 env->GetMethodID(integerClass, "intValue", "()I");
345 jint value = env->CallIntMethod(valueObj, intValueID);
348 } else if (env->IsInstanceOf(valueObj, floatClass)) {
350 env->GetMethodID(floatClass, "floatValue", "()F");
353 jfloat value = env->CallFloatMethod(valueObj, floatValueID);
356 } else if (env->IsInstanceOf(valueObj, byteBufClass)) {
358 env->GetMethodID(byteBufClass, "position", "()I");
362 env->GetMethodID(byteBufClass, "limit", "()I");
365 jint position = env->CallIntMethod(valueObj, positionID);
366 jint limit = env->CallIntMethod(valueObj, limitID);
370 void *data = env->GetDirectBufferAddress(valueObj);
378 env->GetMethodID(byteBufClass, "array", "()[B");
382 (jbyteArray)env->CallObjectMethod(valueObj, arrayID);
385 env->GetByteArrayRegion(
391 env->DeleteLocalRef(byteArray); byteArray = NULL;