From e0ef9fe0ded50ac2c9e40c8616c99007048521c4 Mon Sep 17 00:00:00 2001
From: fhx <308050795@qq.com>
Date: 星期日, 29 九月 2024 18:32:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master-stander' into master-xlk

---
 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