Skip to content

Commit 5338f80

Browse files
author
yuki
committed
[wip]ch 20
1 parent 1566aba commit 5338f80

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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:}

0 commit comments

Comments
 (0)