开发者

Read local compressed XML file(gzip) in Android application

I don't know how to 开发者_StackOverflow社区get an InputStream(Read gzipped local xml file) from the locally stored gzip xml file.

employee.gz

If someone Can help I really appreciate. Thanks


This link works with zip. http://techdroid.kbeanie.com/2010/10/unzip-files-in-android.html

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

This piece of code works.

GZIPInputStream inputStream = new GZIPInputStream(new FileInputStream(new File(
                        "path to file")));

String str = IOUtils.convertStreamToString(inputStream);

I have used a util class which converts the input stream to a string. You might want to do the reading part manually.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜