BASE64中BASE64Encoder、BASE64Decoder,在做一些参数传递的时候用过,在此做个备份
package utils;
import java.io.IOException;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/**
*
* @author 画一
*
*/
public class MainTest {
public static void main(String[] args) {
//编码
BASE64Encoder encoder = new BASE64Encoder();
String base64 = encoder.encode("中软".getBytes());
System.out.println("编码后--"+base64);
//解码
BASE64Decoder decoder = new BASE64Decoder();
try {
byte[] d = decoder.decodeBuffer(base64);
System.out.println("解码后--"+new String(d));
} catch (IOException e) {
e.printStackTrace();
}
}
}