From f118ea5adfab93e5cadc5a1da4011a7030861461 Mon Sep 17 00:00:00 2001 From: msksbr Date: Sun, 16 Jun 2024 16:39:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E5=85=AB=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E9=A2=98=E5=86=99=E5=AE=8C=EF=BC=8C=E5=A4=87=E4=BB=BDreadme.tx?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 实验8/.vscode/settings.json | 3 +++ 实验8/bin/step3/readme.txt | 24 ++++++++++++++++++++++++ 实验8/bin/step3/这里是第三题 | 1 + 实验8/src/step3/DeleteFiles.java | 29 +++++++++++++++++++++++++++++ 实验8/src/step3/readme.txt | 24 ++++++++++++++++++++++++ 5 files changed, 81 insertions(+) create mode 100644 实验8/bin/step3/readme.txt create mode 100644 实验8/bin/step3/这里是第三题 create mode 100644 实验8/src/step3/DeleteFiles.java create mode 100644 实验8/src/step3/readme.txt diff --git a/实验8/.vscode/settings.json b/实验8/.vscode/settings.json index 0ac215c..a2121c3 100644 --- a/实验8/.vscode/settings.json +++ b/实验8/.vscode/settings.json @@ -3,5 +3,8 @@ "java.project.outputPath": "bin", "java.project.referencedLibraries": [ "lib/**/*.jar" + ], + "cSpell.words": [ + "msksbr" ] } diff --git a/实验8/bin/step3/readme.txt b/实验8/bin/step3/readme.txt new file mode 100644 index 0000000..a6322b4 --- /dev/null +++ b/实验8/bin/step3/readme.txt @@ -0,0 +1,24 @@ +Coding by msksbr at +This is a normal java homework project +Intelligence is the ability to avoid doing work, yet getting the work done. +--Linus TorvaldsMIT License + +Copyright (c) 2024 msksbr + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/实验8/bin/step3/这里是第三题 b/实验8/bin/step3/这里是第三题 new file mode 100644 index 0000000..5e1ec9b --- /dev/null +++ b/实验8/bin/step3/这里是第三题 @@ -0,0 +1 @@ +这里是第三题 \ No newline at end of file diff --git a/实验8/src/step3/DeleteFiles.java b/实验8/src/step3/DeleteFiles.java new file mode 100644 index 0000000..041d5fc --- /dev/null +++ b/实验8/src/step3/DeleteFiles.java @@ -0,0 +1,29 @@ +package step3; + +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; + +public class DeleteFiles { + public static void start() throws IOException { + StringBuilder data = new StringBuilder(""); + /********** Begin *********/ + // 读取readme.txt文件 + FileReader sourcesReader = new FileReader("src/step3/readme.txt"); + int read; + while ((read = sourcesReader.read()) != -1) { + data.append((char) read); + } + sourcesReader.close(); + // 写入readmeCopy.txt文件 + File goal = new File("src/step3/readmeCopy.txt"); + FileWriter goalWriter = new FileWriter(goal); + goalWriter.write(data.toString()); + goalWriter.close(); + // 删除readme.txt文件 + File deleteSources = new File("src/step3/readme.txt"); + deleteSources.delete(); + /********** End *********/ + } +} diff --git a/实验8/src/step3/readme.txt b/实验8/src/step3/readme.txt new file mode 100644 index 0000000..a6322b4 --- /dev/null +++ b/实验8/src/step3/readme.txt @@ -0,0 +1,24 @@ +Coding by msksbr at +This is a normal java homework project +Intelligence is the ability to avoid doing work, yet getting the work done. +--Linus TorvaldsMIT License + +Copyright (c) 2024 msksbr + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.