From 9943d7cebd17299875ced8bc37a9581d3429ebe1 Mon Sep 17 00:00:00 2001 From: tqzhang <2452618307@qq.com> Date: Tue, 7 May 2024 16:49:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20src/main/java/com/bonus/au?= =?UTF-8?q?toweb/base/AutoUtils.java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bonus/autoweb/base/AutoUtils.java | 54 ------------------- 1 file changed, 54 deletions(-) delete mode 100644 src/main/java/com/bonus/autoweb/base/AutoUtils.java diff --git a/src/main/java/com/bonus/autoweb/base/AutoUtils.java b/src/main/java/com/bonus/autoweb/base/AutoUtils.java deleted file mode 100644 index d7549bb..0000000 --- a/src/main/java/com/bonus/autoweb/base/AutoUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.bonus.autoweb.base; - -import java.io.*; - - - -public class AutoUtils { - - - /** - * 向text写入数据 - * @param filename - * @param content - */ - public static int write(String filename, String content) { - int code = 0; - try { - FileOutputStream fos = new FileOutputStream(filename); - OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); - BufferedWriter writer = new BufferedWriter(osw); - writer.write(content); - writer.close(); - System.out.println("Text file generated successfully."); - code = 1; - } catch (IOException e) { - code = 0; - System.out.println("An error occurred while generating the text file."); - e.printStackTrace(); - } - return code; - } - - /** - * 从text读取数据 - * @param filename - */ - public static String read(String filename){ - StringBuilder content = new StringBuilder(); - try { - BufferedReader reader = new BufferedReader(new FileReader(filename)); - String line; - while ((line = reader.readLine()) != null) { - content.append(line).append("\n"); - } - reader.close(); - } catch (IOException e) { - System.out.println("An error occurred while reading the text file."); - content.append("error"); - e.printStackTrace(); - } - return content.toString(); - } - -}