我正在尝试解析xml,但是我在setInput方法 parser.setInput(responseStream,null);
时遇到错误responseStream值正在变好。
错误是这样的,
08-28 15:47:37.069: WARN/System.err(5429): Invalid stream or encoding: java.io.IOException: Attempted read on closed stream. (position:START_DOCUMENT null@1:1) caused by: java.io.IOException: Attempted read on closed stream.; nested exception is:
08-28 15:47:37.107: WARN/System.err(5429): java.io.IOException: Attempted read on closed stream.
08-28 15:47:37.165: WARN/System.err(5429): at org.apache.http.conn.EofSensorInputStream.isReadAllowed(EofSensorInputStream.java:127)
08-28 15:47:37.165: WARN/System.err(5429): at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:138)
08-28 15:47:37.186: WARN/System.err(5429): at org.kxml2.io.KXmlParser.setInput(KXmlParser.java:1623)
08-28 15:47:37.196: WARN/System.err(5429): atin.project.parser.Getparser.parser(Getparser.java:31)
08-28 15:47:37.246: WARN/System.err(5429): atin.project.home.HomePgae$DataProvide.doInBackground(HomePgae.java:313)
08-28 15:47:37.279: WARN/System.err(5429): atin.project.home.HomePgae$DataProvide.doInBackground(HomePgae.java:1)
08-28 15:47:37.279: WARN/System.err(5429): at android.os.AsyncTask$2.call(AsyncTask.java:264)
08-28 15:47:37.286: WARN/System.err(5429): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
08-28 15:47:37.306: WARN/System.err(5429): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
08-28 15:47:37.306: WARN/System.err(5429): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
08-28 15:47:37.446: WARN/System.err(5429): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
08-28 15:47:37.516: WARN/System.err(5429): at java.lang.Thread.run(Thread.java:856)
感谢,
答案 0 :(得分:1)
错误告诉你responseStream已经调用了.close()。您之前是否在代码中使用了responseStream,或者将其包含在已调用.close()的任何其他流中?