up vote 1 down vote favorite
share [fb]

I've been porting and application I developed in client Javascript to my server (for a multiplayer game purposes). I am executing some parts using the ScriptEngine because I want to use the same code in the client and the server without having to recode everything twice.

At the beginning it worked fine but then I stumbled uppon the problem of the new typed arrays from HTML5 (Float32Array, Uint8Array...). These arrays are not supported by ScriptEngine (Rhino), and I need them for performance reasons so I cant reimplement them in javascript using non-typed arrays.

I thought to reimplement them using Java and importing the package, but there is no way to reimplement [] operators in Java nor extend the basic arrays (AFAIK).

So at the end Im doing a hack and putting some rules for the developer.

Does anyone knows a solution or a way to reimplement the typed arrays in Java and export them to Javascript?.

Thanks

link|improve this question
feedback

1 Answer

If i am not mistaken, This might help you

http://json.org/java/

link|improve this answer
I don't think that JSON has anything at all to do with the question being asked. – Pointy Jul 27 at 17:28
I was not referring to json, It has class that can convert java collections/array to java script array json.org/javadoc/org/json/JSONStringer.html – Prasanna Talakanti Jul 27 at 17:32
but that is not what I need. I need a native low-level support for typed-arrays inside the Javascript engine of Java. Thanks anyway. – tamat Jul 29 at 11:08
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.