Skip to main content
Known Participant
February 4, 2008
Question

Convert String to ByteArray?

  • February 4, 2008
  • 1 reply
  • 9598 views
Hello,

How does one go about converting a String into a ByteArray? I was hoping the String class would have a method called "GetBytes() or toBytes()", but this doesn't seem to be the case.

Thanks,
Mike
This topic has been closed for replies.

1 reply

February 4, 2008
Have you looked into the various writeBytes functions in the ByteArray itself, particularly:

writeMultiByte(value:String, charSet:String):void
Writes a multibyte string to the byte stream using the specified character set.

writeUTF(value:String):void
Writes a UTF-8 string to the byte stream.

writeUTFBytes(value:String):void
Writes a UTF-8 string to the byte stream.
Participant
February 8, 2008
Aaran,

I'm looking for a way to deserialize a string I got from byteArray.toString(). Is this possible?

Thanks in advance,
Tom