缓存输入/输出流

1)将文件读入内存:

将BufferedInputStream与FileInputStream相接

 FileInputStream in=new  FileInputStream( “file1.txt ” );

 BufferedInputStream bin=new  BufferedInputStream( in); 

 

2)将内存写入文件:

将BufferedOutputStream与 FileOutputStream相接

FileOutputStreamout = new FileOutputStream(“file1.txt”);

BufferedOutputStream  bin = new BufferedInputStream(out);


3)键盘输入流读到内存
将BufferedReader与标准的数据流相接 
InputStreamReader sin = new InputStreamReader (System.in) ;
BufferedReader bin = new BufferedReader(sin);
posted @ 2017-08-14 17:03  beibidewomen  阅读(183)  评论(0编辑  收藏  举报