嗨 交换FileOutputStream中我用这个方法序列化的XML文件到SD卡如何为的BufferedOutputStream
http://www.anddev.org/write_a_simple_xml_file_in_the_sd_card_using_xmlserializer-t8350.html
它工作正常,但在某些时候它停止工作
的问题是大小有关,XML文件大小我的意思是
,因为如果我使用较小的文件,它工作正常
也许如果我用这个方法用的BufferedOutputStream代替FileOutputStream中会工作... 但我不知道如何去适应代码与缓冲工作
蚂蚁这是我的问题,如何将缓冲区添加到该代码。
这是输出的日志我有:
06-04 14:06:09.754:错误/异常(2279):06:09.754,同时创建XML文件 06-04 14发生错误:错误/异常(2279):java.lang.IndexOutOfBoundsException 06-04 14:06:09.754:错误/异常(2279):在org.kxml2.io.KXmlParser.getAttributeValue(KXmlParser.java:1303) 06-04 14:06:09.754:错误/例外(2279):在com.digitalnatura.htmlgenereitor.xml2html.serializartodo(xml2html.java:273) 06-04 14:06:09.754:错误/例外(2279):在com。 digitalnatura.htmlgenereitor.xml2html.onCreate(xml2html.java:44) 06-04 14:06:09.754:错误/异常(2279):at andro id.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 06-04 14:06:09.754:错误/异常(2279):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 06-04 14:06:09.754:错误/异常(2279):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 06-04 14:06:09.754:错误/异常(2279):在android.app。 ActivityThread.access $ 2200(ActivityThread.java:119) 06-04 14:06:09.754:错误/异常(2279):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1863) 06-04 14 :06:09.754:错误/异常(2279):在android.os.Handler.dispatchMessage(Handler.java:99) 06-04 14:06:09.754:错误/异常(2279):在android.os.Looper .loop(Looper.java:123) 06-04 14:06:09.754:错误/异常(2279):在droid.app.ActivityThread.main(ActivityThread.java:4363) 06-04 14:06:09.754:错误/异常(2279):在java.lang.reflect.Method.invokeNative(Native Method) 06-04 14 :06:09.754:错误/异常(2279):在java.lang.reflect.Method.invoke(Method.java:521) 06-04 14:06:09.754:错误/异常(2279):at com.android .internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:860) 06-04 14:06:09.754:错误/异常(2279):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java :618) 06-04 14:06:09.754:ERROR /异常(2279):在dalvik.system.NativeStart.main(本机方法)
这显然是XML编码问题,而不是I/O。你的问题是错误的。 – EJP 2011-06-05 01:46:28
我问了一个清晰的问题,如何更改I/O模式,如果我的问题不同,则无关紧要。如果有人来到这个网站,并搜索如何从FileoutputStream更改为BufferedOutputStream,它会找到答案。有一件事是我的问题,如果我提出了明确的问题,并找到答案答案。 – butelo 2011-06-05 07:13:32
您发布的所有信息都与XML问题有关,并且不能通过更改I/O模式来解决,这本身并不重要。你的最后一句话没有意义。如果您的问题与您的问题无关,那么您应该对其进行重新说明。 – EJP 2011-06-06 07:42:24