public class Base64Util {
//將 BASE64 編碼的字符串 s 進行解碼
public static String getFromBASE64(String s) {
if (s == null) return null;
String decodedString = new String(Base64.decode(s, Base64.DEFAULT));
return decodedString;
}
public static String encode(String s){
if (s == null) return null;
String encode = new String(Base64.encode(s.getBytes(), Base64.DEFAULT));
return encode;
}
項目中有用到 , 感覺比較實用 , 記錄下來以備以后使用 .