50,523
社区成员
发帖
与我相关
我的任务
分享
try {
String str = "hello中文123.#!";
System.out.println("原文:"+str);
byte[] bys = str.getBytes();
BASE64Encoder b64Encoder = new BASE64Encoder();
String ec = b64Encoder.encode(bys);
System.out.println("base64编码:"+ec);
BASE64Decoder b64Decoder = new BASE64Decoder();
bys = b64Decoder.decodeBuffer(ec);
System.out.println("base64解码:"+new String(bys));
} catch (IOException e) {
e.printStackTrace();
}