???????? close ?
????Java????????????????????е???????????????????????????????????????????? close ???????????????????????????????
???????????????????????????????ж??????????????????????д?????????????ж?????????
????Reader??Writer
????1. ???????????????????????
????2. Java????????????????????????????????????????????????????????????????????????
????????????????????μ?????—— ???FileWriter ?? FileReader??????????????????????
public class FileStreamDemo2 {
public static void main(String[] args) {
File f = new File("Hello.txt");
try {
FileWriter out = new FileWriter(f);
out.write("hello world??hahaha");
out.close();
} catch (Exception e) {
e.printStackTrace();
}
try {
FileReader in = new FileReader(f);
char[] buf = new char[1024];
int len = in.read(buf);
System.out.println(new String(buf??0??len));
} catch (Exception e) {
e.printStackTrace();
}
}
}
????FileReader??????????????????????????????????
????PipedInputStream ?? PipedOutputStream
???????PipeInputStream???????????PipedOutputStream??????????????????????????
??????????????????????????????? --- p 266
???????????PipedInputStream??????????????????PipedOutputStream?????ж???????
????void connect(PipedOutputStream src)???????????????????????? src??
????JDK??????PipedWriter??PipedReader??????????????????????????????
??????ù????????????????????????????????????
????ByteArrayInputStream ?? ByteArrayOutputStream
????1. ??????????????????
????2. ????????IO?????????????????????????д
????IO???????????
??????????б???? -1 ???????????OS??? -1 ??????????????????β???
??????????????????????
????1. ??????????????洢???????????????а????????????????????????????????
????2. ?????????????????????
????????????????????豸??Java?????????????????????System.in ?? System.out
????System.in ??????????InPutStream?????????????????
????System.out ??????????PrintStream?????
????Scanner??
????????????IO????????util??
???????????????????????????????????????????????????????
????Scanner ??÷????????????????????????????÷????????????????????ò????next ????????????????????????????
?????????????????????
????<span style="font-size:14px;">      Scanner cin = new Scanner(System.in);
????String name = cin.nextLine();</span>
??????????????????
????--- ???м???????????IO?豸??д?????????????????????
????DataOutputStream
????writeBoolean()
????writeShort()
????writeChar()
????writeInt()
????......