1. 编码格式 是 string 和 byte 之间的格式:
String s1 = Base64.encode("中".getBytes("utf-8"));
System.out.println(s1);
byte[] b2 = Base64.decode(s1);
String s2 = new String(b2,"UTF-8");
System.out.println(s2);
2. 区别
3. 总结
本文通过实例演示了如何使用Base64进行字符串的编码与解码,重点介绍了在Java环境中,如何将UTF-8编码的字符串转换为Base64格式,以及如何将Base64格式的数据还原为原始字符串。
1. 编码格式 是 string 和 byte 之间的格式:
String s1 = Base64.encode("中".getBytes("utf-8"));
System.out.println(s1);
byte[] b2 = Base64.decode(s1);
String s2 = new String(b2,"UTF-8");
System.out.println(s2);
2. 区别
3. 总结

被折叠的 条评论
为什么被折叠?