From 83455446544f89b0663a3f520744331ad8259289 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期五, 02 二月 2024 17:49:43 +0800 Subject: [PATCH] 1. 新增导入静安监测数据功能模块 --- src/main/kotlin/com/flightfeather/uav/common/utils/FileUtil.kt | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/common/utils/FileUtil.kt b/src/main/kotlin/com/flightfeather/uav/common/utils/FileUtil.kt index f290f76..851cedf 100644 --- a/src/main/kotlin/com/flightfeather/uav/common/utils/FileUtil.kt +++ b/src/main/kotlin/com/flightfeather/uav/common/utils/FileUtil.kt @@ -13,7 +13,7 @@ class FileUtil { private var file: File - private var basePath:String = "${File.separator}ObdData${File.separator}" + private var basePath:String = "${File.separator}UAVData${File.separator}" private var closeThread: Thread? = null private var fw: FileWriter? = null private var bw: BufferedWriter? = null @@ -36,7 +36,7 @@ } } - fun saveObdData(str: String) { + fun saveObdData(str: String, newFile: Boolean = false) { //妫�鏌ユ枃妗f槸鍚﹀瓨鍦� if (!file.exists()) { file.parentFile.mkdirs() @@ -45,7 +45,7 @@ println("----鍒涘缓鏂囦欢锛�${file.absolutePath}") } //鏂囦欢鏈�澶�512Kb,瓒呰繃鍚庢柊寤烘枃妗� - if (file.length() + str.toByteArray().size > 512 * 1024 || TimeUtil.isNextDay(oldTime, Date())) { + if (newFile || file.length() + str.toByteArray().size > 512 * 1024 || TimeUtil.isNextDay(oldTime, Date())) { //瓒呰繃涓�澶╁悗锛屾洿鏂板綋鍓嶆椂闂� oldTime = Date() @@ -59,10 +59,10 @@ flush() close() } - fw?.run { - flush() - close() - } +// fw?.run { +// flush() +// close() +// } //鏂板缓杈撳嚭娴� fw = FileWriter(file, true) bw = BufferedWriter(fw) @@ -79,7 +79,7 @@ flush() } - readyToShutDownStream(bw, fw) +// readyToShutDownStream(bw, fw) println("----鍐欏叆瀹屾垚") } -- Gitblit v1.9.3