java.util.Base64 基本使用

 @Test
                           public void de() throws Exception {
                              final Base64.Decoder decoder = Base64.getDecoder();
                              final Base64.Encoder encoder = Base64.getEncoder();
                              final String text = "字串文字";
                              final byte[] textByte = text.getBytes("UTF-8");
                              //編碼
                              final String encodedText = encoder.encodeToString(textByte);
                             System.out.println(encodedText);
                             //解碼
                             System.out.println(new String(decoder.decode(encodedText), "UTF-8"));
                             }

posted @   锐洋智能  阅读(1046)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· Obsidian + DeepSeek:免费 AI 助力你的知识管理,让你的笔记飞起来!
· 解决跨域问题的这6种方案,真香!
· Windows 提权-UAC 绕过
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示