JInterface question

Olivier Sambourg olivier.sambourg@REDACTED
Wed Jun 15 17:14:12 CEST 2005


Hi everyone

I'm trying to encapsulate erlang data inside an XMPP (jabber) stream and 
retrieve the data with a java client.
So on the server side it looks like this :

1> httpd_util:encode_base64(binary_to_list(term_to_binary("test"))).
"g2sABHRlc3Q="

And on the client side I've tried the following :
OtpErlangString S = new OtpErlangString("test");
OtpOutputStream B = new OtpOutputStream(B);
Base64.encodeObject(B.toByteArray()); -> 
"rO0ABXVyAAJbQqzzF/gGCFTgAgAAeHAAAAAHawAEdGVzdA=="
Base64.encodeBytes(B.toByteArray()); -> "awAEdGVzdA=="
Base64.encodeObject(B.toString()); -> 
"rO0ABXQALmNvbS5lcmljc3Nvbi5vdHAuZXJsYW5nLk90cE91dHB1dFN0cmVhbUBmNjQzOGQ="

I've also tried to build an OtpErlangBinary from the OtpOutputStream, then 
use the toString() method, to no avail...

(I'm using the Base64 java library from 
http://iharder.sourceforge.net/base64/ but I guess the problem does not come 
from this)

Do you have any suggestions to my problem ? I guess I'm just not using the 
right transformation in Java to reproduce the 
binary_to_list(term_to_binary()) operation...

Thank you

--
Olivier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20050615/8ed8320a/attachment.htm>


More information about the erlang-questions mailing list