简体   繁体   中英

Passing binary data from Javascript into a Java applet via LiveConnect

I'm working on an application with a javascript front end that can receive a bunch of octets from the server (for the time being I'm using php's chr() to simulate some data).

Trying to pass the data from javascript into an applet to be manipulated is proving difficult. Since the data can have nulls mid-string, it looks like it gets terminated at the first null going in. It also looks like once the binary data touches a javascript variable the encoding messes with some of the bytes (or maybe that's just a problem with how I'm displaying it)

Either way, what options do I have for taking a block of binary data, sent from a server and putting it into a Java applet to be manipulated. Is a conversion to base64 (or some other encoding) my only option if I want to maintain data integrity?

All this is new to me, so hopefully I got things across clearly.

Ah the bane of liveconnect.
Yes, you either need or use urlencode or base64 to get your data through.

Even when passing stuff from JavaScript to Flash (or back) you need to this, because the interface in between uses null terminated strings (which is just stupid, I know).

I think that architecture when your java script gets binary data and passes it to java applet is not optimal. Did you probably think to modify applet to make it to go directly to server and get the binary data? Without any java script?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM