String vs. ByteArray

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

String vs. ByteArray

Schwab,Wilhelm K
I have written a fair amount of code to exchange ascii data with something that, all too recently, I discovered has a binary capability that is potentially very useful to me.  My question is how to get out of this mess :)   I create write streams on strings and write characters and strings to them and send the contents to the system.  How different are strings and byte arrays?  I recall seeing stringOrByteArray in a few places (some of that code is my own, written in Dolphin and carefully structured to note the underlying string, etc.).  Is there anything I should keep in mind to make the transition less painful?

Can I keep the strings and simply add binary with #asString, or change it all to byte arrays and get away with a similar trick?  Can a binary or text stream change "personality" on the fly?  I suspect that there are many hard ways out of this and probably only one or two smart ways.

Bill



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: String vs. ByteArray

Lukas Renggli
Maybe http://book.seaside.st/book/in-action/serving-files/character-encodings
helps?

Lukas

On 27 August 2010 00:34, Schwab,Wilhelm K <[hidden email]> wrote:

> I have written a fair amount of code to exchange ascii data with something that, all too recently, I discovered has a binary capability that is potentially very useful to me.  My question is how to get out of this mess :)   I create write streams on strings and write characters and strings to them and send the contents to the system.  How different are strings and byte arrays?  I recall seeing stringOrByteArray in a few places (some of that code is my own, written in Dolphin and carefully structured to note the underlying string, etc.).  Is there anything I should keep in mind to make the transition less painful?
>
> Can I keep the strings and simply add binary with #asString, or change it all to byte arrays and get away with a similar trick?  Can a binary or text stream change "personality" on the fly?  I suspect that there are many hard ways out of this and probably only one or two smart ways.
>
> Bill
>
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project