File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ 1:package ch18;
2+ 2:
3+ 3:import java.io.*;
4+ 4:
5+ 5:/**
6+ 6: * @author: yuki
7+ 7: * @date: 2018/10/9
8+ 8: */
9+ 9:public class BasicFileOutput {
10+ 10:
11+ 11: static String file = "src/main/resources/BasicFileOutput.out";
12+ 12:
13+ 13: public static void main(String[] args) throws IOException {
14+ 14: BufferedReader in = new BufferedReader(
15+ 15: new StringReader(
16+ 16: BufferedInputFile.read("src/main/java/ch18/BasicFileOutput.java")
17+ 17: )
18+ 18: );
19+ 19: PrintWriter out = new PrintWriter(
20+ 20: new BufferedWriter(new FileWriter(file))
21+ 21: );
22+ 22:
23+ 23: int lineCount = 1;
24+ 24: String s;
25+ 25: while((s=in.readLine()) != null){
26+ 26: out.println(lineCount++ + ":" + s);
27+ 27: }
28+ 28: in.close();
29+ 29: out.close();
30+ 30: System.out.println(BufferedInputFile.read(file));
31+ 31:
32+ 32: }
33+ 33:
34+ 34:}
You can’t perform that action at this time.
0 commit comments