Base64编码与解码
来源:互联网 发布:手机上头像源码怎么用 编辑:程序博客网 时间:2024/05/16 08:00
import java.io.UnsupportedEncodingException;/** * Base64工具类 * @author liqijing * */public class Base64Tools {// 加密 @SuppressWarnings("restriction")public static String getBase64(String str) { byte[] b = null; String s = null; try { b = str.getBytes("utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } if (b != null) { s = new sun.misc.BASE64Encoder().encode(b); } return s; } // 解密 @SuppressWarnings("restriction")public static String getFromBase64(String s) { byte[] b = null; String result = null; if (s != null) { sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder(); try { b = decoder.decodeBuffer(s); result = new String(b, "utf-8"); } catch (Exception e) { e.printStackTrace(); } } return result; } }
0 0
- Base64编码与解码
- BASE64编码与解码
- BASE64编码与解码
- Base64编码与解码
- base64编码与解码
- base64编码与解码
- Base64 编码与解码
- Base64编码与解码
- Base64编码与解码
- Base64编码与解码
- base64编码与解码
- BASE64编码与解码
- Base64编码与解码
- Base64编码与解码
- Base64编码解码与实现
- BASE64的解码与编码
- 用Base64编码与解码
- Base64编码解码与实现
- 1039. Course List for Student (25)
- 数据挖掘之 时间序列分析
- 初试Twitter API
- POJ 1008 (模拟)
- php array_filter过滤数组为空值
- Base64编码与解码
- Android M InCallUI动画简析
- C语言中访问结构体成员时 点 . 和 箭头 -> 的区别
- View事件分发机制
- Linux 网络 I/O 模型简介(图文)
- HTML文档设置标记
- LeetCode 045 Jump Game II
- hdu 2852 线段树 单点更新
- Leetcode no. 257