最佳班base64编码/解码的动作脚本? [英] Best Class for base64 encoding/decoding Action Script?

查看:325
本文介绍了最佳班base64编码/解码的动作脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是BASE64用于加密/解密的动作脚本最佳类?

What would be a best Class for base64 encryption/decryption in Action Script?

推荐答案

的Adobe有两个utils的本 - <一个href=\"http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/utils/Base64En$c$cr.html\">Base64En$c$cr &安培; <一href=\"http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/utils/Base64De$c$cr.html\">Base64De$c$cr.二者都位于mx.utils包。虽然,我不得不跟踪他们到这里 - <一个href=\"http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/Base64En$c$cr.as\">en$c$cr &安培; <一href=\"http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/Base64De$c$cr.as\">de$c$cr.

Adobe has two utils for this - Base64Encoder & Base64Decoder. Both are located in the mx.utils package. Although, I had to track them down here - encoder & decoder.

用法会是这样的:

var bmd:BitmapData = myBitmap.bitmapData;
var ba:ByteArray = bmd.getPixels(new Rectangle(0,0,bmd.width,bmd.height));
var b64:Base64Encoder = new Base64Encoder();
b64.encodeBytes(ba);
trace(b64.toString());

同样,'b64.en code'会带code的字符串,而不是为ByteArray。

Similarly, 'b64.encode' would encode a String rather than a ByteArray.

无论是EN codeR和去codeR各自的结果添加到内部缓冲区。所以,你只需要使用'的toString'返回当前缓冲区。

Both the encoder and decoder add their respective results to an internal buffer. So, you just have to use 'toString' to return the current buffer.

这篇关于最佳班base64编码/解码的动作脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆