MCPcopy Create free account
hub / github.com/Tencent/MMKV / jbyteArray decodeBytes

Function jbyteArray decodeBytes

Android/MMKV/mmkv/src/main/cpp/native-bridge.cpp:720–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

718}
719
720MMKV_JNI jbyteArray decodeBytes(JNIEnv *env, jobject obj, jlong handle, jstring oKey) {
721 MMKV *kv = reinterpret_cast<MMKV *>(handle);
722 if (kv && oKey) {
723 string key = jstring2string(env, oKey);
724 mmkv::MMBuffer value;
725 auto hasValue = kv->getBytes(key, value);
726 if (hasValue) {
727 jbyteArray result = env->NewByteArray(value.length());
728 env->SetByteArrayRegion(result, 0, value.length(), (const jbyte *) value.getPtr());
729 return result;
730 }
731 }
732 return nullptr;
733}
734
735MMKV_JNI jobjectArray allKeys(JNIEnv *env, jobject instance, jlong handle, jboolean filterExpire) {
736 MMKV *kv = reinterpret_cast<MMKV *>(handle);

Callers

nothing calls this directly

Calls 2

jstring2stringFunction · 0.70
getBytesMethod · 0.45

Tested by

no test coverage detected