Base64加密解密util
来源:互联网 发布:中国超级高铁计划知乎 编辑:程序博客网 时间:2024/06/11 07:43
import java.io.UnsupportedEncodingException;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* 将String进行base64编码解码,使用utf-8
*/
public class Base64Util {
private static final Log logger = LogFactory.getLog(Base64Util.class);
/**
* 对给定的字符串进行base64解码操作
*/
public static String decodeData(String inputData) {
try {
if (null == inputData) {
return null;
}
return new String(Base64.decodeBase64(inputData.getBytes("utf-8")), "utf-8");
} catch (UnsupportedEncodingException e) {
logger.error(inputData, e);
}
return null;
}
/**
* 对给定的字符串进行base64加密操作
*/
public static String encodeData(String inputData) {
try {
if (null == inputData) {
return null;
}
return new String(Base64.encodeBase64(inputData.getBytes("utf-8")), "utf-8");
} catch (UnsupportedEncodingException e) {
logger.error(inputData, e);
}
return null;
}
}
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* 将String进行base64编码解码,使用utf-8
*/
public class Base64Util {
private static final Log logger = LogFactory.getLog(Base64Util.class);
/**
* 对给定的字符串进行base64解码操作
*/
public static String decodeData(String inputData) {
try {
if (null == inputData) {
return null;
}
return new String(Base64.decodeBase64(inputData.getBytes("utf-8")), "utf-8");
} catch (UnsupportedEncodingException e) {
logger.error(inputData, e);
}
return null;
}
/**
* 对给定的字符串进行base64加密操作
*/
public static String encodeData(String inputData) {
try {
if (null == inputData) {
return null;
}
return new String(Base64.encodeBase64(inputData.getBytes("utf-8")), "utf-8");
} catch (UnsupportedEncodingException e) {
logger.error(inputData, e);
}
return null;
}
}
0 0
- Base64加密解密util
- base64 加密解密函数
- BASE64加密/解密
- BASE64加密解密
- Base64 加密 解密
- base64加密解密
- Base64加密和解密
- Base64加密、解密
- Base64加密解密
- base64加密解密
- javascript Base64加密解密
- base64的加密解密
- Java BASE64加密解密
- base64 加密解密
- BASE64加密解密(字符串)
- Base64 加密 解密
- base64加密解密
- Base64加密解密
- PAT_乙级_1008_筱筱
- window系统开启超级管理员账户
- 在linux系统中挂载U盘
- 链接、装载与库——目标文件(2)
- 来电拦截、来电挂断,通过反射实现一键挂断
- Base64加密解密util
- jQuery获取option方法汇总
- [乐意黎原创]PHP抛Notice: ob_flush(): failed to flush buffer. No buffer to flush...
- linux基础学习10
- 欢迎使用CSDN-markdown编辑器
- [Java]serialVersionUID是干什么用的?(一)
- matlab下WindowMediaPlayer测试使用
- Ubuntu下安装JDK及配置环境变量
- BOM对象模型应用分析