android Base64编码/转码记录

2017-09-19  本文已影响11人  S晔枫
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;
}

项目中有用到 , 感觉比较实用 , 记录下来以备以后使用 .

上一篇下一篇

猜你喜欢

热点阅读