|
1
2
3
4
5
6
7
8
9
10
11
|
byte[]
cipherData = Base64.encodeBase64(plainText.getBytes()); //默认不换行 byte[]
cipherData = Base64.encodeBase64(plainText.getBytes(), false); //取消换行 byte[]
cipherData = Base64.encodeBase64Chunked(plainText.getBytes()); //进行换行 String
cipherText = Base64.encodeBase64String(plainText.getBytes()); //转为字符串 2.
安全的url:转换+为-、/为_、将多余的=去掉Java代码 byte[]
cipherData = Base64.encodeBase64(plainText.getBytes(), false, true); byte[]
cipherData = Base64.encodeBase64URLSafe(plainText.getBytes()); String
cipherText = Base64.encodeBase64URLSafeString(plainText.getBytes()); |
java中使用base64笔记
最新推荐文章于 2024-11-05 13:23:28 发布
本文详细介绍了Base64编码的不同应用场景及其在Java中的实现方式,包括标准Base64编码、URL安全的Base64编码、编码后的数据换行处理及转换为字符串的方法。
773

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



