Google 网上论坛不再支持新的 Usenet 帖子或订阅项。历史内容仍可供查看。

Asking help for a java io problem

已查看 0 次
跳至第一个未读帖子

witk...@163.com

未读,
2006年1月17日 09:31:562006/1/17
收件人
Hello, guys! I have a problem running the following code with eclipse
showing that:

java.io.IOException: Stream closed
at sun.nio.cs.StreamDecoder.ensureOpen(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at HtmlFileParser.parseHtmlDoc(HtmlFileParser.java:32)
at HtmlFileParser.main(HtmlFileParser.java:52)

//code here:
try{
FileInputStream fin = new FileInputStream("test.html");
InputStreamReader fr = new InputStreamReader(fin);
for(i=0; i<2048; i++) buf[i] = '0';
fr.read(buf, 0, 2048); //problem here (line 32)
FileWriter fw = new FileWriter("bufWriteTest.txt");
fw.write(buf);
fw.flush();
}
catch(FileNotFoundException e) {
e.printStackTrace();
}
catch(IOException e) {
e.printStackTrace();
}
There are no syntax erro in the above code, it just dosen't work,
please help me finding out what the problem is, thank you.

kly...@comcast.net

未读,
2006年1月17日 10:01:302006/1/17
收件人
Are you sure the file test.html exists, and that you have access to it?

0 个新帖子