5/19/2011 3:14:46 AM
Title:
how to convert Byte Array to string.
Hello i record a microphone data into Byte array and then using binary socket(not XML socket) i send that data.
using the socket.writeBytes(byteArray) i can send the raw data successfully to destination but
i have to send the data with some more information.
so i thought of converting the byteArray to string then again append the required string to that converted string.
but when i do byteArray.toString() then data is not same.
if anyone knows how to change the byteArray to string please let me know.
thanx in advance
5/20/2011 3:04:57 AM
to convert byteArray to string in flex or flash builder actionscript 3 you can use
//to convert byteArray to string
var myStr:String = byteArr.toString();
// convert string back into byteArray
var myByteArr:ByteArray= new ByteArray();
for(var i:int =0; i<myStr.length; i++)
{
myByteArr.writeByte( myStr.charCodeAt( i ) );
}
2/10/2012 4:32:22 AM
// convert string back into byteArray
var myByteArr:ByteArray= new ByteArray();
for(var i:int =0; i<myStr.length; i++)
{
myByteArr.writeByte( myStr.charCodeAt( i ) );
}
it is not working for me....