惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Last Week in AI
Last Week in AI
H
Help Net Security
博客园 - 叶小钗
V
Visual Studio Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
腾讯CDC
MongoDB | Blog
MongoDB | Blog
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
GbyAI
GbyAI
Microsoft Security Blog
Microsoft Security Blog
A
About on SuperTechFans
博客园 - 司徒正美
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
月光博客
月光博客
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
Vercel News
Vercel News

博客园 - 筱老邪

2026年读书清单,及java技术的巩固 请求处理 图片转为为流的处理 SHA1签名算法,JAVA和C# C#与Java互通AES算法加密解密 在Java和C#中计算SHA-1哈希 .net5读取xml文件 部署linux 踩坑 多线程 .net知识点 下载文件,204问题 debug和release的web.config分开配置 数据库的索引查找 sql 查询出符合条件的表增加字段 HTTP状态码:400\500 错误代码 - 筱老邪 - 博客园 linq 两个list交集差集处理 rabbitMQ的使用 rabbitMQ的部署安装 sql 游标循环
编码和解码
筱老邪 · 2025-05-19 · via 博客园 - 筱老邪
public static String toBase64String(String value) throws UnsupportedEncodingException {
if (value == null || value.isEmpty()) {
return "";
}
byte[] bytes = value.getBytes(StandardCharsets.UTF_8);
return java.net.URLEncoder.encode(new String(Base64.getEncoder().encode(bytes)), "UTF-8");
}

public static String UnBase64String(String value) throws UnsupportedEncodingException {
if (value == null || value.isEmpty()) {
return "";
}
String decodeValue= java.net.URLDecoder.decode(value, "UTF-8");
byte[] decodedBytes = Base64.getDecoder().decode(decodeValue);
return new String(decodedBytes,StandardCharsets.UTF_8);
}