62,629
社区成员




public static String StrToBase64(String s)
throws UnsupportedEncodingException {
if (s == null)
return null;
return (new sun.misc.BASE64Encoder()).encode(s.getBytes("UTF-8"));
}
// 把64bit编码转化成普通字符串
public static String Base64ToStr(String s) {
if (s == null)
return null;
BASE64Decoder decoder = new BASE64Decoder();
try {
byte[] b = decoder.decodeBuffer(s);
return new String(b, "UTF-8");
} catch (Exception e) {
return null;
}
}