Base64 Java org.apache.commons.codec.binary.Base64
来源:互联网 发布:pc电脑软件大全 编辑:程序博客网 时间:2024/06/06 23:54
Base64组成由 26个区分大小写字母 + 10个数字 + 一个加号 和 一个/
package com.base64;import java.io.UnsupportedEncodingException;import org.apache.commons.codec.binary.Base64;public class Base64_ {public static String base64encode(String message) {try {byte[] encodeBase64 = Base64.encodeBase64(message.getBytes("UTF-8"));System.out.println("Result:" + new String(encodeBase64));return new String(encodeBase64);} catch (UnsupportedEncodingException e) {throw new RuntimeException();}}public static String base64decode(String message) {byte[] encodeBase64 = Base64.decodeBase64(message);System.out.println("Result:" + new String(encodeBase64));return new String(encodeBase64);}}
<pre name="code" class="java">package com.base64;public class Base64Test {public static void main(String[] args) {String str = "Hello World";String str2 = Base64_.base64encode(str);System.out.println(str2);String str1 = Base64_.base64decode(str2);System.out.println(str1);}}
需要引包 import org.apache.commons.codec.binary.Base64;
apacheBase64包
0 0
- Base64 Java org.apache.commons.codec.binary.Base64
- org.apache.commons.codec.binary.Base64 加密解密
- org.apache.commons.codec.binary.Base64图片加密解密
- org.apache.commons.codec.binary.Base64 加密解密
- [随手记]Android import org.apache.commons.codec.binary.Base64
- org.apache.commons.codec.binary.Base64 加密解密
- ANDROID : java.lang.NoSuchMethodError: 在 org.apache.commons.codec.binary.Base64
- org.apache.commons.codec.binary.Base64与sun.misc.BASE64Encoder等效
- 使用org.apache.commons.codec做md5&SHA1&BASE64加密
- Base64编码实现二---使用org.apache.tomcat.util.codec.binary.Base64实现Base64
- Java Code Examples for org.apache.commons.codec.binary.Base64InputStream
- 使用Apache commons-codec Base64实现加解密
- 使用apache commons-codec base64将文件转为字符串
- 使用Apache commons-codec Base64实现加解密
- apache commons-codec base64将文件转为字符串
- Apache commons codec |MD5 SHA BASE64 简单方便操作
- 使用Apache commons-codec Base64实现加解密(转)
- JAVA利用commons codec与bouncy castle进行base64加密
- forward和redirect的区别
- 关于datasnap服务器中一个内存错误的问题
- css布局--2016.3.17
- 使用OpenGL搜集的问题资料
- 代码实现内存溢出
- Base64 Java org.apache.commons.codec.binary.Base64
- 二分查找法需要注意什么
- HTML5新控件 - 搜索框
- C++智能指针
- MVP for Android: 如何组织显示层的内容
- ftp协议的URL定制
- 【案例】RAID卡写策略改变引发的问题
- Oracle高级查询之OVER (PARTITION BY ..)
- LVDS接口详解