四大抽象基类:InputStream OutputStream Reader Writter
四大访问文件类:File- File- File- File
四大访问数组:ByteArray- ByteArray- CharArray- CharArray-
四大缓冲流:Buffered- Buffered- Buffered- Buffered-
字节流byte(Input/OutputStream):8bit
字符流char(Reader、Writter):16bit
文本文件(输出字节流)---》InputStreamReader(输出字符流)--》程序(输出字符流)--》OutputStreamWritter(输出字节流)---》文件
文件操作:
StringBuffer sb = new StringBuffer();
byte[] b = new byte[20];//每次读20个字节
int len;
while((len = fileInputStream.read(b)) != -1){
String str = new String(b,0,len);
sb.append(str);
}