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

Java IO之有緩沖的文本輸入

2013-11-23 19:15:08  來源: 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-2013 電腦知識網 Computer Knowledge   All rights reserved.