实验八第三题写完,备份readme.txt
This commit is contained in:
Vendored
+3
@@ -3,5 +3,8 @@
|
|||||||
"java.project.outputPath": "bin",
|
"java.project.outputPath": "bin",
|
||||||
"java.project.referencedLibraries": [
|
"java.project.referencedLibraries": [
|
||||||
"lib/**/*.jar"
|
"lib/**/*.jar"
|
||||||
|
],
|
||||||
|
"cSpell.words": [
|
||||||
|
"msksbr"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
这里是第三题
|
||||||
@@ -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 *********/
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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.
|
||||||
Reference in New Issue
Block a user