??????????????
????void close()???????д????????ù?????????
????void flush()??OutputStream?????flush()??????????κβ??????????Щ???л???????????????BufferedOutputStream??PrintStream????????flush()????????????????????????д????????????????????????У??????????????????д????????С???????????????????????????????????????flush()????????????????????д?????????
????????????????
??????????????? BufferedInputStream??BufferedOutputStream????????????????????????дI/O?豸????????????????????
??????????????????????
????????????DataInputStream??DateOutputStream????????????????????????ж??????????(int??char??long??)??????.
????FileInputStream??FileOutputStream????д?????????????????????????????????а????
???????????????????д??
????????????????????????????????????
?????????
?????????????????????Reader??Writer??Reader????????Writer?????????
????Reader???????????????????????????????Reader?????????????????????????????е??????????????????Reader????????????????????????????????
1 package src;
2
3 import java.io.File;
4 import java.io.FileNotFoundException;
5 import java.io.FileReader;
6 import java.io.FileWriter;
7 import java.io.IOException;
8
9 public class Test {
10
11     public static void main(String[] args) {
12
13           File f1=new File("d:\file1.txt");
14
15           File f2=new File("d:\file2.txt");
16
17           try {
18             FileReader fis=new FileReader(f1);
19             FileWriter fos=new FileWriter(f2);
20
21              int m;
22              while((m=fis.read())!=-1)
23              {
24                  //????????????
25                  //System.out.print((char)(m));
26                  //?????file2.txt?????
27                  fos.write((char)(m));
28              }
29
30         } catch (FileNotFoundException e) {
31             // TODO ???????? catch ??
32             e.printStackTrace();
33         } catch (IOException e) {
34             // TODO ???????? catch ??
35             e.printStackTrace();
36         }
37     }
38 }
????????????????
???????????????????????д?????
????????????BufferedReader????????BufferedWriter?????
??????????????????????????????InputStreamReader????????InputStreamWriter????
??????????????????????????????????????
???????????????
????System????Java????????????????????????????????
???????????/?????????????????????System????????????
?????????System????????????????????????????????
????System???????System.in??System.out??System??????????
????????????????????????/???????
???????У?System.in??????????????????????????????????
???????????????????System.out?????????????????????????
????????????????????System.err??????????????????????????
?????????????
????System.in????????????????????
????System.in?????InputStream??????InputStream???е??????System.in?ж??С?
1 package src;
2
3 import java.io.IOException;
4
5 public class Test {
6
7     public static void main(String[] args) {
8
9         System.out.println("???????????");
10         try {
11             int i = System.in.read();
12             System.out.println("????????????"+(char)i);
13         } catch (IOException e) {
14             // TODO Auto-generated catch block
15             e.printStackTrace();
16         }
17     }
18 }
1 //???????????????????????????“q”????
2 package src;
3
4 import java.io.File;
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         File f = new File("d:\file1.txt");
14         try {
15             FileOutputStream fop = new FileOutputStream(f);
16             while(true){
17                 //????????????
18                 byte[] b = new byte[1024];
19                 System.out.println("???????????");
20                 //???????????????????У???????????????
21                 int len = System.in.read(b);
22                 if(b[0]=='q'){
23                     System.out.println("???");
24                     break;
25                 }else{
26                     //???????0????????len?????
27                     fop.write(b?? 0?? len);
28                 }
29             }
30         } catch (FileNotFoundException e) {
31             // TODO Auto-generated catch block
32             e.printStackTrace();
33         } catch (IOException e) {
34             // TODO Auto-generated catch block
35             e.printStackTrace();
36         }
37
38     }
39 }
??????????
????FileInputStream??FileOutputStream????д??????????????дint??double??????????????????????????а????
????????????DataInputStream??DataOutputStream???????????д???????????????а????????д????????????????????????
????DataInputStream??
??????????
????DataInputStream(InputStream in)
???????????
????boolean readBoolean()  //?????????????????????
????byte readByte()  //??????????????byte???
????char readChar()  //??????????????char???
????double readDouble()  //??????????????double???
????float readFloat()  //??????????????float???
????int readInt()  //?????????ж?????int???
????String readUTF()  //???????????UTF???????

???????????????????
????BufferedReader??BufferedWriter?????????BufferedInputStream??BufferedOutputStream??????????滺??????????I/O?豸??д???????????????????????
????BufferedReader??BufferedWriter???????????????????????????????????????д?????????????????ж?д??????
?????????
??????????????????????????????????????????????ж?????????????????????????????????????????????д??????????????????????????????洢?????????????????????
????JavaSE API???????????????InputStreamReader??OutputStreamWriter????????????????????????????????????????????????