MCPcopy Create free account
hub / github.com/DuGuQiuBai/Java / main

Method main

day21/code/day21_IO2/src/cn/itcast_03/CopyFileDemo.java:21–44  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

19 */
20public class CopyFileDemo {
21 public static void main(String[] args) throws IOException {
22 // ��װ����Դ
23 FileReader fr = new FileReader("a.txt");
24 // ��װĿ�ĵ�
25 FileWriter fw = new FileWriter("b.txt");
26
27 // ��д
28 // ��ʽ1
29 // int ch = 0;
30 // while ((ch = fr.read()) != -1) {
31 // fw.write(ch);
32 // }
33
34 // ��ʽ2
35 char[] chs = new char[1024];
36 int len = 0;
37 while ((len = fr.read(chs)) != -1) {
38 fw.write(chs, 0, len);
39 }
40
41 // �ͷ���Դ
42 fw.close();
43 fr.close();
44 }
45}

Callers

nothing calls this directly

Calls 3

readMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected