警告: BASE64Decoder是内部专用 API, 可能会在未来发行版中删除
警告: BASE64Decoder是内部专用 API, 可能会在未来发行版中删除
代码语言:javascript代码运行次数:0运行复制import org.apachemons.codec.binary.Base64;
public class Base64Encoder {
/**
* @param bytes
* @return
*/
public static byte[] decode(final byte[] bytes) {
return Base64.decodeBase64(bytes);
}
/**
* 二进制数据编码为BASE64字符串
*
* @param bytes
* @return
* @throws Exception
*/
public static String encode(final byte[] bytes) {
return new String(Base64.encodeBase64(bytes));
}
}
//原来的方式
// byte[] bytes = new BASE64Decoder().decodeBuffer(base64);
//替换后的方式
byte[] bytes = Base64Encoder.decode(base64.getBytes());
//原来的方式
// result = Base64.encode(str4);
//替换后的方式
result = Base64Encoder.encode(str4);
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。 原始发表:2022-10-08,如有侵权请联系 cloudcommunity@tencent 删除apibase64byte二进制字符串发布者:admin,转转请注明出处:http://www.yc00.com/web/1754983024a5223966.html
评论列表(0条)