cannot find symbol class BASE64Encoder location: package sun.misc

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/jenkins/agent/workspace/pipeline_p-cgs8h-1/src/main/java/com/xx/sea/base/util/EncryptionCoder.java:[9,16] cannot find symbol
  symbol:   class BASE64Decoder
  location: package sun.misc
[ERROR] /home/jenkins/agent/workspace/pipeline_p-cgs8h-1/src/main/java/com/xx/sea/base/util/EncryptionCoder.java:[10,16] cannot find symbol
  symbol:   class BASE64Encoder
  location: package sun.misc
[INFO] 2 errors 

修改为

 

util.Base64

import java.util.Base64;

/**
 * BASE64解密
 * 
 * @param key
 * @return
 * @throws Exception
 */
public static byte[] decryptBASE64(String key) throws Exception {
    Base64.Decoder decoder=Base64.getMimeDecoder();
    return decoder.decode(key);
}

/**
 * BASE64加密
 * 
 * @param key
 * @return
 * @throws Exception
 */
public static String encryptBASE64(byte[] key) throws Exception {
    Base64.Encoder encoder=Base64.getMimeEncoder();
    return encoder.encodeToString(key);
}
发布了636 篇原创文章 · 获赞 58 · 访问量 47万+

猜你喜欢

转载自blog.csdn.net/wxb880114/article/details/104178931
今日推荐