美文网首页
android Base64编码/转码记录

android Base64编码/转码记录

作者: S晔枫 | 来源:发表于2017-09-19 15:52 被阅读11次
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;
}

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

相关文章

网友评论

      本文标题:android Base64编码/转码记录

      本文链接:https://www.haomeiwen.com/subject/wbawsxtx.html