[Json-rpc-java] about byte[]

Arthur Blake arthur.blake at gmail.com
Sat Sep 15 06:24:57 SGT 2007


That's a really good question... a quick look at the code shows that there
is indeed code in the ArraySerializer that can serialize a byte array, but I
don't believe it would ever get called because the StringSerializer has
precedence.

My best guess for the reason is that a byte array is not a very efficient
thing to represent in JavaScript.

The closest you could have is an array of numbers (which would end up being
an array of floating point double values because all numbers in JavaScript
are floating points.)  Probably most people who are dealing with byte arrays
are really dealing with an underlying String representation and maybe that's
why the code was written this way...

I'm curious what exactly you are using this byte array for on the JavaScript
side?


On 9/14/07, #Cyrille37# <cyrille37 at gmail.com> wrote:
>
> Hello,
>
> Why the byte[] serialization is done by StringSerializer ?
> I'd moved byte[] serialization from StringSerializer to ArraySerializer.
> It works and I find it clearest.
>
> Is there a good reason to put it in StringSerializer ?
>
> Cheers
> Cyrille.
>
> PS : thanks a lot for your great json-rpc library. I use it every day !
> So cool, fast and easy to use. For debugging remoting it is a pleasure
> to read data exchange in a human and simple format which does not take
> much cpu resource to compite. And I cam make javascript, flash, java,
> php and csharp communicate easy ! Really a great job ! THANKS A LOT !!
>
>
> _______________________________________________
> Json-rpc-java mailing list
> Json-rpc-java at oss.metaparadigm.com
> http://oss.metaparadigm.com/mailman/listinfo/json-rpc-java
>


More information about the Json-rpc-java mailing list