From d0b19298e28a9b8b50c778704b77160f17e73950 Mon Sep 17 00:00:00 2001
From: jialh <1972868360@qq.com>
Date: 星期五, 17 四月 2026 18:20:38 +0800
Subject: [PATCH] 水电话费
---
java110-utils/src/main/java/com/java110/utils/util/Base64Convert.java | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/java110-utils/src/main/java/com/java110/utils/util/Base64Convert.java b/java110-utils/src/main/java/com/java110/utils/util/Base64Convert.java
old mode 100644
new mode 100755
index ea14408..23edb02
--- a/java110-utils/src/main/java/com/java110/utils/util/Base64Convert.java
+++ b/java110-utils/src/main/java/com/java110/utils/util/Base64Convert.java
@@ -1,12 +1,13 @@
package com.java110.utils.util;
-import sun.misc.BASE64Decoder;
-import sun.misc.BASE64Encoder;
-
import java.io.*;
+
+import org.apache.commons.codec.binary.Base64;
public class Base64Convert {
+ private static final Base64 base64 = new Base64();
+
private void Base64Convert() {
}
@@ -25,7 +26,7 @@
byte[] bytes = new byte[in.available()];
// 灏嗘枃浠朵腑鐨勫唴瀹硅鍏ュ埌鏁扮粍涓�
in.read(bytes);
- strBase64 = new BASE64Encoder().encode(bytes); //灏嗗瓧鑺傛祦鏁扮粍杞崲涓哄瓧绗︿覆
+ strBase64 = base64.encodeToString(bytes); //灏嗗瓧鑺傛祦鏁扮粍杞崲涓哄瓧绗︿覆
} finally {
if (in != null) {
in.close();
@@ -45,7 +46,7 @@
public static String byteToBase64(byte[] bytes) {
String strBase64 = null;
// in.available()杩斿洖鏂囦欢鐨勫瓧鑺傞暱搴�
- strBase64 = new BASE64Encoder().encode(bytes); //灏嗗瓧鑺傛祦鏁扮粍杞崲涓哄瓧绗︿覆
+ strBase64 = base64.encodeToString(bytes); //灏嗗瓧鑺傛祦鏁扮粍杞崲涓哄瓧绗︿覆
return strBase64;
}
@@ -61,7 +62,7 @@
*/
public static byte[] base64ToByte(String strBase64) throws IOException {
// 瑙g爜锛岀劧鍚庡皢瀛楄妭杞崲涓烘枃浠�
- byte[] bytes = new BASE64Decoder().decodeBuffer(strBase64); //灏嗗瓧绗︿覆杞崲涓篵yte鏁扮粍
+ byte[] bytes = base64.decode(strBase64); //灏嗗瓧绗︿覆杞崲涓篵yte鏁扮粍
return bytes;
}
}
--
Gitblit v1.8.0