| 17 | } |
| 18 | |
| 19 | float* GetJFloatBuffer(JNIEnv * env, jobject buffer, int32_t len) { |
| 20 | jmethodID mid = env->GetMethodID(env->GetObjectClass(buffer), "isDirect", "()Z"); |
| 21 | if (mid == 0) throw Exception("Could not find isDirect() method"); |
| 22 | if(!env->CallBooleanMethod(buffer, mid)) { |
| 23 | std::ostringstream err; |
| 24 | err << "the FloatBuffer object is not 'direct' it needs to be created "; |
| 25 | err << "from a ByteBuffer.allocateDirect(..).asFloatBuffer() call."; |
| 26 | throw Exception(err.str().c_str()); |
| 27 | } |
| 28 | if(env->GetDirectBufferCapacity(buffer) != len) { |
| 29 | std::ostringstream err; |
| 30 | err << "the FloatBuffer object is not allocated correctly it needs to "; |
| 31 | err << "of size " << len << " but is "; |
| 32 | err << env->GetDirectBufferCapacity(buffer) << "."; |
| 33 | throw Exception(err.str().c_str()); |
| 34 | } |
| 35 | return (float*)env->GetDirectBufferAddress(buffer); |
| 36 | } |
| 37 | |
| 38 | const char* GetOCIOTClass(ConstTransformRcPtr tran) { |
| 39 | if(ConstAllocationTransformRcPtr at = DynamicPtrCast<const AllocationTransform>(tran)) |
no outgoing calls
no test coverage detected