Base64 替换 BASE64Encoder

时间:2021-03-16 14:04:57   收藏:0   阅读:0

代码

        //base64编码
        String a = new String(base64.encode(text.getBytes("UTF-8")));
        String b = new String(Base64.encodeBase64(text.getBytes("UTF-8")));
        String c = new BASE64Encoder().encode(text.getBytes("UTF-8"));
        //base64解码
        String aa = new String(base64.decode(a));
        String bb = new String(Base64.decodeBase64(b));
        String cc = new String(new BASE64Decoder().decodeBuffer(c));

        System.out.println("a=" + a);
        System.out.println("b=" + b);
        System.out.println("c=" + c);
        System.out.println("aa=" + aa);
        System.out.println("bb=" + bb);
        System.out.println("cc=" + cc);

结果

技术图片

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!