问题描述
在 Action Script 中进行 base64 加密/解密的最佳类是什么?
Adobe 为此提供了两个实用程序 - Base64Encoder &Base64Decoder.两者都位于 mx.utils 包中.虽然,我不得不在这里追踪它们 - 编码器 &解码器.>
用法类似于:
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);跟踪(b64.toString());
同样,'b64.encode' 将编码一个字符串而不是一个字节数组.
编码器和解码器都将各自的结果添加到内部缓冲区中.所以,你只需要使用 'toString' 来返回当前缓冲区.
What would be a best Class for base64 encryption/decryption in Action Script?
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.
The usage would be something like:
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());
Similarly, 'b64.encode' would encode a String rather than a ByteArray.
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 编码/解码动作脚本的最佳类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!