I/O小结
1 读写字符文件
BufferedReader br = new BufferedReader (new FileReader("文件路径"));
BufferedWriter br = new BufferedWriter (new FileWriter("文件路径",boolean));
2 读取字节文件
DataInputStream dis = new DataInputStream(new FileInputStream("文件路径"));
DataOutputStream dis = new DataOutputStream(new FileOutputStream("文件路径"));
3 读取整个字符文件
String str = null;
while((str=br.readLine())!=null){
System.out.println(str);
}
4读取整个字节文件
int b;
while((b=dis.read())!=-1){
System.out.println(b);
}