Alex is right, except that you should use: _byteArr.writeUTFBytes. Radu On Wed, Nov 26, 2014 at 10:24 AM, Devesh Mishra(NABFS00) < devesh.dmis...@igate.com> wrote:
> I tried, but it seems that complier is unable to find writeUTFBytes() > method. > It says, Call to a possibly undefined method writeUTFBytes through a > reference with static type Class. > > Flex SDK: 4.6 > AIR Version: 15.0.0.293 > > -- > Thanks & Regards, > Devesh Mishra > > -----Original Message----- > From: Alex Harui [mailto:aha...@adobe.com] > Sent: Wednesday, November 26, 2014 9:47 PM > To: users@flex.apache.org > Subject: Re: String to ByteArray > > Base64Decoder expects Base64 text format. > Base64Encoder would convert your String to Base64 text format, but that > doesn’t seem very efficient. > ByteArray.writeUTFBytes will add the String to the ByteArray. > > Does that help? > -Alex > > On 11/26/14, 3:37 AM, "Devesh Mishra(NABFS00)" <devesh.dmis...@igate.com> > wrote: > > >Hi, > > > >I am trying to get byteArray from a String using below code. But > >getting an error. > > > >var _strEncode:String = "Sample String"; var _byteArr:ByteArray = new > >ByteArray(); var decoder:Base64Decoder = new Base64Decoder(); > >decoder.decode(_strEncode); _byteArr = decoder.toByteArray(); > > > >Error: A partial block (1 of 4 bytes) was dropped. Decoded data is > >probably truncated! > > > >Any Help ! > > > >-- > >Thanks & Regards, > >Devesh Mishra > > > >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Disclaimer~~~ > >~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >Information contained and transmitted by this e-mail is confidential > >and proprietary to IGATE and its affiliates and is intended for use > >only by the recipient. If you are not the intended recipient, you are > >hereby notified that any dissemination, distribution, copying or use of > >this e-mail is strictly prohibited and you are requested to delete this > >e-mail immediately and notify the originator or mailad...@igate.com > ><mailto:mailad...@igate.com>. IGATE does not enter into any agreement > >with any party by e-mail. Any views expressed by an individual do not > >necessarily reflect the view of IGATE. IGATE is not responsible for the > >consequences of any actions taken on the basis of information provided, > >through this email. The contents of an attachment to this e-mail may > >contain software viruses, which could damage your own computer system. > >While IGATE has taken every reasonable precaution to minimise this > >risk, we cannot accept liability for any damage which you sustain as a > >result of software viruses. You should carry out your own virus checks > >before opening an attachment. To know more about IGATE please visit > >www.igate.com <http://www.igate.com>. > >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Disclaimer~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Information contained and transmitted by this e-mail is confidential and > proprietary to IGATE and its affiliates and is intended for use only by the > recipient. If you are not the intended recipient, you are hereby notified > that any dissemination, distribution, copying or use of this e-mail is > strictly prohibited and you are requested to delete this e-mail immediately > and notify the originator or mailad...@igate.com <mailto: > mailad...@igate.com>. IGATE does not enter into any agreement with any > party by e-mail. Any views expressed by an individual do not necessarily > reflect the view of IGATE. IGATE is not responsible for the consequences of > any actions taken on the basis of information provided, through this email. > The contents of an attachment to this e-mail may contain software viruses, > which could damage your own computer system. While IGATE has taken every > reasonable precaution to minimise this risk, we cannot accept liability for > any damage which you sustain as a result of software viruses. You should > carry out your own virus checks before opening an attachment. To know more > about IGATE please visit www.igate.com <http://www.igate.com>. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >