posts - 609,  comments - 13,  views - 64万
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

Map<String,String> queryMap = new HashMap<>();
queryMap.put("name","jay.star");
String jsonStr = JSON.toJSONString(queryMap);// 转成json com.alibaba.fastjson
byte[] bytes = jsonStr.getBytes(StandardCharsets.ISO_8859_1);// 转成byte数组
String encodeData = new String(android.util.Base64.encode(bytes, android.util.Base64.NO_WRAP));// 转成Base64
System.out.println("base64:" + encodeData);
byte[] decode = android.util.Base64.decode(encodeData, Base64.NO_WRAP);// 解码
String s = new String(decode);// byte[]转字符串
System.out.println("decode base64:"+s);

posted on   邢帅杰  阅读(444)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】
历史上的今天:
2022-07-21 sqlserver索引碎片整理
2022-07-21 sqlserver中pivot(行转列),unpivot(列转行)
2016-07-21 使用Resource Owner Password Credentials Grant授权发放Token
点击右上角即可分享
微信分享提示