public static String getBASE64(String s) {
if (s == null) return null;
return (new sun.misc.BASE64Encoder()).encode( s.getBytes() );
}
if (s == null) return null;
return (new sun.misc.BASE64Encoder()).encode( s.getBytes() );
}
本文介绍了一种使用Java实现字符串Base64编码的方法。通过一个简单的公共静态方法getBASE64,可以将输入的字符串转换为Base64编码格式。此方法首先检查字符串是否为空,若非空则利用sun.misc.BASE64Encoder类完成编码。
4万+
7178

被折叠的 条评论
为什么被折叠?