Java??I/O?????
???????????? ???????[ 2015/10/22 13:57:51 ] ??????????????????? ???????
????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()??????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11