9 输入输出流
流是一组有顺序的,有起点和终点的字节集合,是对数据传输的总称
Buffered:缓冲-->提高存取速度
9.1 字节流
InputStream
public class ISR_Stream {
public static void main(String[] args) throws IOException {
gbk();
}
private static void gbk() throws IOException {
InputStreamReader isr=new InputStreamReader(new FileInputStream("路径"),"GBK");
isr.read();
int len=0;
while ((len=isr.read())!=-1){
System.out.println((char)len);
}
isr.close();
}
}
public class Buffered_FIS {
public static void main(String[] args) throws IOException {
FileInputStream fis=new FileInputStream("C:\\Users\\Sky\\Desktop\\.io.txt");
BufferedInputStream bis=new BufferedInputStream(fis);
int len=0;
/* 优化
byte [] bytes = new byte[1024];
int len=0;
while((