zoukankan      html  css  js  c++  java
  • WinJS Base64编码和解码 metro

    之前用纯JS编码和解码字符串,因为字符串大小为2M多,所以效率相当慢,得两三秒。

    之后改为了用windos api编码解码,效率一下提高,基本没有延迟的感觉。

    metro下的Javascript base64编码:


    var Base64 = {
        //编码
        encode: function (input) {
            var output = "";
            var buffer = Windows.Security.Cryptography.CryptographicBuffer.convertStringToBinary(input,"utf8");//字符串转缓存
            output = Windows.Security.Cryptography.CryptographicBuffer.encodeToBase64String(buffer);//将缓存编码,返回编码后的字符串
            return output;
        },
        //解码
        decode: function (input) {
            var output = "";
            var buffer = Windows.Security.Cryptography.CryptographicBuffer.decodeFromBase64String(input);//将base64解码为缓存
            output = Windows.Security.Cryptography.CryptographicBuffer.convertBinaryToString("utf8", buffer);//将缓存转为字符串
            return output;

        }

    }

  • 相关阅读:
    R中的一些数据形式
    R数据处理
    矩阵的一些知识
    R语言的一些矩阵运算
    R语言中的常用函数
    R读取数据和导出数据
    贝叶斯公式的理解方式
    R语言中bioconductor包
    R语言中的数据结构
    网页版的R设置环境变量
  • 原文地址:https://www.cnblogs.com/beenupper/p/2849852.html
Copyright © 2011-2022 走看看