标签:cep out hid gif stat readline 使用 throw []
package com.java.io; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; public class BufferedInputFile { public static String read(String pathname) throws IOException { BufferedReader in = new BufferedReader(new FileReader(new File(pathname))); String s; StringBuilder sb = new StringBuilder(); while((s = in.readLine())!=null){ sb.append(s + "\n") ; } in.close(); return sb.toString(); } public static void main(String[] args) throws IOException { System.out.print(read("src/com/java/io/BufferedInputFile.java")); } }
console将当前的BufferedInputFile.java文件原封不动的打印出来;
标签:cep out hid gif stat readline 使用 throw []
原文地址:http://www.cnblogs.com/tenWood/p/7468041.html