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

Method main

day21/code/day21_IO2/src/cn/itcast_02/CopyFileDemo.java:17–41  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

15 */
16public class CopyFileDemo {
17 public static void main(String[] args) throws IOException {
18 // ��װ����Դ
19 InputStreamReader isr = new InputStreamReader(new FileInputStream(
20 "InputStreamReaderDemo.java"));
21 // ��װĿ�ĵ�
22 OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(
23 "Copy.java"));
24
25 // ��ʽ1
26 // int ch = 0;
27 // while ((ch = isr.read()) != -1) {
28 // osw.write(ch);
29 // }
30
31 // ��ʽ2
32 char[] chs = new char[1024];
33 int len = 0;
34 while ((len = isr.read(chs)) != -1) {
35 osw.write(chs, 0, len);
36 }
37
38 // �ͷ���Դ
39 osw.close();
40 isr.close();
41 }
42}

Callers

nothing calls this directly

Calls 3

readMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected