?
java.io.InputStream is = null;
is = Test.Class.getResourceAsStream("test.template");
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line = null;
String content =";
while((line = reader.readLine())!=null){
??? content = content +??? line;
}
reader.close();
return line;
我人為這樣讀能夠把整個文件都讀到,
要是采取以下方式來讀,要是文件比較大的情況可能會讀不到!
java.io.InputStream is = Test.Class.getResourceAsStream("test.template");
byte[] b = new byte[is.available()];
is. read(b,0,is.available());
String result = new String(b);
return result;
文件如果比較大的情況下可能會讀不到!!!!后面出現方框,!!!!!
原因是什么不太清楚
posted on 2006-04-13 08:43
小小程序程序員混口飯吃 閱讀(259)
評論(0) 編輯 收藏 所屬分類:
java