From b335505d7f27b035f0cea35d85517929c394c6d6 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 17 Mar 2025 15:11:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=89=E5=8F=B0=E6=9C=AA=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fangjia/script/gj/ccb/FileUtils.groovy | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ccb/FileUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ccb/FileUtils.groovy index 795297501..576869ecd 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ccb/FileUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ccb/FileUtils.groovy @@ -104,6 +104,43 @@ class FileUtils { sb.setLength(0) } out.close(); + return sb.toString().getBytes(charset) + } + + static def createEncryptFile(fileName, outputStr, isAppend){ + OutputStream out = new FileOutputStream(fileName, isAppend); + out.write(outputStr.getBytes("utf-8")); + out.close(); + } + + + static def createFileStringByCustomSuffix(ret, fileName, charset, suffix, lineSuffix){ + File file = new File(fileName); +// if (file.exists()) { +// file.delete(); +// } + + if (!file.getParentFile().exists()) { + boolean result = file.getParentFile().mkdirs(); + if (!result) { + System.out.println("´´½¨Ä¿Â¼Ê§°Ü"); + } + } + def sb = new StringBuffer(); + def index = 0 + for(def row : ret){ + if(row){ + index++ + sb.append(StringUtils.join(row.toArray(), suffix)) + if(index