阅读Android应用程序的本地COM pressed XML文件(GZIP) [英] Read local compressed XML file(gzip) in Android application
问题描述
我不知道如何让一个的InputStream
(读取gzip压缩的本地XML文件)从本地存储的 gzip的XML
文件。
I don't know how to get an InputStream
(Read gzipped local xml file) from the locally stored gzip xml
file.
employee.gz
如果有人能帮助我真是AP preciate。谢谢
If someone Can help I really appreciate. Thanks
推荐答案
该链接的作品带拉链。 http://techdroid.kbeanie.com/2010/10/unzip -files功能于android.html
This link works with zip. http://techdroid.kbeanie.com/2010/10/unzip-files-in-android.html
我不知道这是否与GZ文件的工作,但你可以试试看。有在开发文档上GZIPInputStream类的文档。
I am not sure if it will work with gz files, but you could give it a try. There's a documentation on GZIPInputStream class on the dev docs.
http://developer.android.com/reference/java/ UTIL / ZIP / GZIPInputStream.html
这件code的作品。
This piece of code works.
GZIPInputStream inputStream = new GZIPInputStream(new FileInputStream(new File(
"path to file")));
String str = IOUtils.convertStreamToString(inputStream);
我已经使用该输入流转换为字符串的Util类。您可能需要使用手动的阅读部分。
I have used a util class which converts the input stream to a string. You might want to do the reading part manually.
这篇关于阅读Android应用程序的本地COM pressed XML文件(GZIP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!