i/o比较好的规范用法:

[color=indigo]1) File file = new File ("hello.txt");
FileInputStream in=new FileInputStream(file);


2) File file = new File ("hello.txt");
FileInputStream in=new FileInputStream(file);
InputStreamReader inReader=new InputStreamReader(in);
BufferedReader bufReader=new BufferedReader(inReader);

3) File file = new File ("hello.txt");
FileReader fileReader=new FileReader(file);
BufferedReader bufReader=new BufferedReader(fileReader);

流(stream)分成两类:输入流和输出流 (输入输出是相对内存来说的)
io常用的输入输出流其实都是继承自4个抽象类,分别是
基于单字节(字节流)的inputstream ,outputstream类
基于双字节(字符流)的unicode代码单元的reader,writer类
一旦打开输入流后,程序就可以从输入流串行的读数据
从输入流读数据的过程一般如下:
open a stream
while more information
read information
close the stream [/color]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值