public static void iprByCharArray(File file) throws IOException {
if(!file.exists()){
throw new IllegalArgumentException("文件不存在");
}
if(!file.isFile()){
throw new IllegalArgumentException("不是文件");
}
FileInputStream in=new FileInputStream(file);
InputStreamReader ipr=new InputStreamReader(in);
int c;
char[] chars=new char[2*1024];
System.out.println("字符流批量读取");
while ((c=ipr.read(chars,0,chars.length))!=(-1)){
System.out.print(chars);
}
}楼上+1
字符流,读出来是个字符啊,一串字符不就是字符串了吗