From dc0ab49aadefcc880d97d687c1deefc176cf5bbd Mon Sep 17 00:00:00 2001
From: fwq <582742538@qq.com>
Date: 星期五, 27 九月 2024 17:23:16 +0800
Subject: [PATCH] 其-修改版本号

---
 hx_common/src/main/java/com/hx/util/CVSUtil.java |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/hx_common/src/main/java/com/hx/util/CVSUtil.java b/hx_common/src/main/java/com/hx/util/CVSUtil.java
index 3a71f6c..c593825 100644
--- a/hx_common/src/main/java/com/hx/util/CVSUtil.java
+++ b/hx_common/src/main/java/com/hx/util/CVSUtil.java
@@ -53,4 +53,24 @@
         fos.close();
 
     }
+
+    public static void writeToCVS_1(String path, String[] headers, List<List<String>> data) throws Exception {
+        FileOutputStream fos = new FileOutputStream(path);
+        byte[] uft8bom = { (byte) 0xef, (byte) 0xbb, (byte) 0xbf };
+        fos.write(uft8bom);
+        OutputStreamWriter osw = new OutputStreamWriter(fos, "utf-8");
+
+        CSVFormat csvFormat = CSVFormat.DEFAULT.withHeader(headers);
+        CSVPrinter csvPrinter = new CSVPrinter(osw, csvFormat);
+
+        for (int i = 0; i < data.size(); i++) {
+            csvPrinter.printRecord(data.get(i));
+        }
+
+        csvPrinter.flush();
+        csvPrinter.close();
+        osw.close();
+        fos.close();
+
+    }
 }

--
Gitblit v1.8.0