亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

windows有可直接調用的base64編碼解碼函數嗎解決思路?

windows有可直接調用的base64編碼解碼函數嗎解決思路?

慕容森 2018-09-19 10:06:03
windows有可直接調用的base64編碼解碼函數嗎解決思路
查看完整描述

1 回答

?
DIEA

TA貢獻1820條經驗 獲得超2個贊

import sun.misc.BASE64Encoder;
import sun.misc.BASE64Decoder;

// 將 s 進行 BASE64 編碼
public static String getBASE64(String s) {
if (s == null) return null;
return (new sun.misc.BASE64Encoder()).encode( s.getBytes() );
}

// 將 BASE64 編碼的字符串 s 進行解碼
public static String getFromBASE64(String s) {
if (s == null) return null;
BASE64Decoder decoder = new BASE64Decoder();
try {
byte[] b = decoder.decodeBuffer(s);
return new String(b);
} catch (Exception e) {
return null;
}
}

查看完整回答
反對 回復 2018-10-04
  • 1 回答
  • 0 關注
  • 1580 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號