????Java??I/O??????
??????java?????У???????????????/?????????”??“???????е??
????????????????????????????
????Java??????????????浱?У??γ????????????Щ??????д???????
????Java????????????????????????????????????????????
?????????????????????????????????????д????
????Java????????????????????????????????
???????????????????λ??????????????????????8λ??????????????????????д????????????????
???????????????????λ????????????????????д????????
?????????
?????????????????????InputStream??OutpuStream??
????InputStream????????OutputStream?????????
1     package src;
2
3     import java.io.File;
4     import java.io.FileInputStream;
5     import java.io.FileNotFoundException;
6     import java.io.FileOutputStream;
7     import java.io.IOException;
8
9     public class Test {
10
11         public static void main(String[] args) {
12             //??????->???????????????:??->??д????
13
14             //??????file1?????????????棬a.???????????????b.?????file2?????
15             //1?????????????file1??????????????????????file2?????????
16               File f1=new File("c:\file1.txt");
17
18               File f2=new File("c:\file2.txt");
19              //2?? ???????????c:\file1.txt????????????fis?????????????c:\file2.txt??????? ?????fos??
20               try {
21                 FileInputStream fis=new FileInputStream(f1);
22                 FileOutputStream fos=new FileOutputStream(f2);
23               //3???????fis?????????棬?????д??file2???
24                  int m;
25                  while((m=fis.read())!=-1)
26                  {
27                      fos.write(m);
28                  }
29
30
31
32             } catch (FileNotFoundException e) {
33                 // TODO ???????? catch ??
34                 e.printStackTrace();
35             } catch (IOException e) {
36                 // TODO ???????? catch ??
37                 e.printStackTrace();
38             }
39
40
41
42         }
43     }

????InputStream??:InputStream???????????????????????????????
????InputStream??????????????????????????????ж??????Щ?????????????????????????????????в??????
????OutputStream????????????????????????????????????????????????????к?д?????й???????
????OutputStream????????????д???????write()??????