package com.wyq.print;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
public class TestReader {
public static void main(String[] args) throws IOException {
//搭桥
Reader r = new InputStreamReader(new FileInputStream("d:/a.txt"));
/**
*转换流:
*从文件中读取字节流,然后转换成字符流
*/
//读取
char ch [] = new char [1024];
String str [] = new String [1024];
int length = 0;//读到的字符的个数
while((length = r.read(ch))!=-1){
System.out.println(new String(ch,0,length));
//这里调用String的构造方法
}
//关闭流对象
r.close();
}
}