Просмотр исходного кода

fix(backend): 修复 Java 8 兼容性问题 - readAllBytes 改用 readStream

iwt 1 месяц назад
Родитель
Сommit
4509608daa

+ 11 - 1
cfc-backend/src/main/java/com/etotem/cfc/service/ReportFingerprintService.java

@@ -175,4 +175,14 @@ public class ReportFingerprintService {
             return null;
         }
     }
-}
+
+    private String readStream(InputStream is) throws IOException {
+        ByteArrayOutputStream buf = new ByteArrayOutputStream();
+        byte[] temp = new byte[1024];
+        int read;
+        while ((read = is.read(temp)) > 0) {
+            buf.write(temp, 0, read);
+        }
+        return buf.toString("UTF-8");
+    }
+}