字符串BASE64互相转换


public static String strConvertBase(String str) {
if(null != str){
Base64.Encoder encoder = Base64.getEncoder();
return encoder.encodeToString(str.getBytes());
}
return null;
}

public static String baseConvertStr(String str) {
if(null != str){
Base64.Decoder decoder = Base64.getDecoder();
try {
return new String(decoder.decode(str.getBytes()), "GBK");
} catch (UnsupportedEncodingException e) {
return null;
}
}
return null;
}

 

转载,出处:https://blog.csdn.net/pmdream/article/details/81383484


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM