熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java核心技術 >> 正文

Java IO之有緩沖的文本輸入

2022-06-13   來源: Java核心技術 

  輸入就是Input(I)

  view plainprint?
package comsinosupermandriver;

  import javaioBufferedReader;
import javaioFile;
import javaioFileReader;
import javaioIOException;

  public class MainBench {
    public static void main(String[] args) throws IOException {
        MyStream stream = new MyStream(temp/testtxt);
    }
}

  class MyStream {
    public MyStream(String pathName) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader(new File(pathName)));
        String line = brreadLine();
        while (line != null) {
            Systemoutprintln(line);
            line = brreadLine();
        }
        brclose();
    }
}


From:http://tw.wingwit.com/Article/program/Java/hx/201311/26523.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.