这个问题虽然不影响项目的运行,但是有点强迫症的开发者估计还是想将它彻底消灭掉,网上很多文章提及的是将maven的版本升级,但是个人感觉治标不治本。其实我们可以运用其他的方法代替sun.misc.BASE64Decoder,避免去使用它。
采用org.apache.commons.codec.binary.Base64替换
maven依赖地址 :https://mvnrepository.com/artifact/commons-codec/commons-codec/1.10
import org.apache.commons.codec.binary.Base64;
/**
* @author cool
* @version V1.0
* @className Base64Encoder
* @description Problem In Chair, Not In Computer.
* @createDate 2018年07月09日
*/
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));
}
}
本文介绍了一种替代sun.misc.BASE64Decoder的方法,通过使用org.apache.commons.codec.binary.Base64来解决某些开发者遇到的问题。这种方法不仅避免了直接使用sun.misc.BASE64Decoder,还提供了一个更为稳定和可靠的解决方案。
2874

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



