转换流
package com.ran;
import java.io.*;
public class Ran {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("hello.txt");
InputStreamReader isr = new InputStreamReader(fis); //使用系统默认的字符集
//参数二指明了字符集,具体使用哪个字符集,取决于文件保存时使用的字符集
// InputStreamReader isr = new InputStreamReader(fis,"UTF-8"); //使用系统默认的字符集
char[] qqq=new char[5];
int len;
while ((len=isr.read(qqq))!=-1){
String str=new String(qqq,0,len);
System.out.print(str);
}
isr.close();
}
}