| 66 | } |
| 67 | |
| 68 | PAG_API jobject Java_org_libpag_PAGFile_LoadFromBytes(JNIEnv* env, jclass, jbyteArray bytes, |
| 69 | jint length, jstring jpath) { |
| 70 | if (bytes == nullptr) { |
| 71 | LOGE("PAGFile.LoadFromBytes() Invalid pag file bytes specified."); |
| 72 | return nullptr; |
| 73 | } |
| 74 | auto data = env->GetByteArrayElements(bytes, nullptr); |
| 75 | if (env->ExceptionCheck()) { |
| 76 | env->ExceptionClear(); |
| 77 | return nullptr; |
| 78 | } |
| 79 | if (data == nullptr) { |
| 80 | LOGE("PAGFile.LoadFromBytes() Failed to get byte array elements."); |
| 81 | return nullptr; |
| 82 | } |
| 83 | auto path = SafeConvertToStdString(env, jpath); |
| 84 | auto pagFile = PAGFile::Load(data, static_cast<size_t>(length), path); |
| 85 | env->ReleaseByteArrayElements(bytes, data, 0); |
| 86 | if (pagFile == nullptr) { |
| 87 | LOGE("PAGFile.LoadFromBytes() Invalid pag file bytes specified."); |
| 88 | return nullptr; |
| 89 | } |
| 90 | return ToPAGLayerJavaObject(env, pagFile); |
| 91 | } |
| 92 | |
| 93 | PAG_API jobject Java_org_libpag_PAGFile_LoadFromAssets(JNIEnv* env, jclass, jobject managerObj, |
| 94 | jstring pathObj) { |
nothing calls this directly
no test coverage detected