File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -818,6 +818,20 @@ NAN_METHOD(Java::newArray) {
818818 }
819819 }
820820
821+ else if (strcmp (className.c_str (), " float" ) == 0 ) {
822+ results = env->NewFloatArray (arrayObj->Length ());
823+ for (uint32_t i=0 ; i<arrayObj->Length (); i++) {
824+ v8::Local<v8::Value> item = arrayObj->Get (i);
825+ jobject val = v8ToJava (env, item);
826+ jclass floatClazz = env->FindClass (" java/lang/Float" );
827+ jmethodID float_floatValue = env->GetMethodID (floatClazz, " floatValue" , " ()F" );
828+ jfloat floatValues[1 ];
829+ floatValues[0 ] = env->CallFloatMethod (val, float_floatValue);
830+ checkJavaException (env);
831+ env->SetFloatArrayRegion ((jfloatArray)results, i, 1 , floatValues);
832+ }
833+ }
834+
821835 else if (strcmp (className.c_str (), " boolean" ) == 0 ) {
822836 results = env->NewBooleanArray (arrayObj->Length ());
823837 for (uint32_t i=0 ; i<arrayObj->Length (); i++) {
You can’t perform that action at this time.
0 commit comments