package com.imooc.learn1; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; public class IsrAndOswDemo { public static void main(String[] args) throws IOException { FileInputStream fileInputStream=new FileInputStream("E:\\HTML\\01.html"); InputStreamReader inputStreamReader=new InputStreamReader(fileInputStream); // int c; // while ((c=inputStreamReader.read())!=-1) { // System.out.print((char) c); // // } //创建批量读取的模式 char[] buffer=new char[8*1024]; int dd; while((dd=inputStreamReader.read(buffer, 0, buffer.length))!=-1) { String s=new String(buffer,0,dd); System.out.println(s); } } }