//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or // click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter. import java.io.*;//缓冲字符流读取文本 public class Main { public static void main(String[] args) throws IOException { String thisLine; int count=0; try { FileReader fr=new FileReader("d:\\test2.txt"); BufferedReader bfr=new BufferedReader(fr); while((thisLine=bfr.readLine())!=null) { count++; System.out.println(thisLine); } System.out.println("共读取了"+"count"); bfr.close(); } catch(IOException e){ System.out.println("错误"); } } }
缓冲字符流读取文本
最新推荐文章于 2024-07-10 21:37:49 发布