标签:
package com.smart.base; import org.apache.commons.codec.binary.Base64; public class Base64Test { private static String src = "imooc security base64"; public static void main(String[] args) { // commonsBase64(); bouncyBase64(); } public static void commonsBase64(){ byte[] encodeBytes = Base64.encodeBase64(src.getBytes()); System.out.println("encode:"+new String(encodeBytes)); byte[] decodeBytes = Base64.decodeBase64(encodeBytes); System.out.println(new String(decodeBytes)); } public static void bouncyBase64(){ byte[] encodeBytes = org.bouncycastle.util.encoders.Base64.encode(src.getBytes()); System.out.println(new String(encodeBytes)); byte[] decodeBytes = org.bouncycastle.util.encoders.Base64.decode(encodeBytes); System.out.println(new String(decodeBytes)); } }
标签:
原文地址:http://www.cnblogs.com/james-roger/p/4973717.html