FileReader fr = new FileReader("E:\\Java基础资料\\a.txt");
char[] chars = new char[2];
while (true) {
int len = fr.read(chars);
if (len == -1)
break;
System.out.print(new String(chars, 0, len));
}
fr.close();
read (char[] buffer) 方法:读取数据,解码,强转三步合并了,把强转之后的字符放到了字符数组当中,相当于空参的 read() 方法再加上强制类型转换
标签:fr,Java,read,char,buffer,new From: https://www.cnblogs.com/gagaya2/p/17783500.html