首页 > 学院 > 开发设计 > 正文

转换流(InputStreamReader)

2019-11-11 05:01:50
字体:
来源:转载
供稿:网友
package inputDemo;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.IOException;import java.io.InputStreamReader;/** * InputStreamRead是一个读入器,同时也是一个 转换流; * InputStreamRead类将含有字节的流转换为Unicode编码的字符流; * * @author king_wang * */public class InputStreamReadDemo { public static void main(String[] args) throws IOException{ InputStreamReader in=new InputStreamReader( new FileInputStream("E://file.txt")); int c = -1; while((c = in.read()) != -1){ System.out.PRint((char)c); } in.close(); }}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表