Android: read a GZIP file in the ASSETS folder

后端 未结 6 1392
不思量自难忘°
不思量自难忘° 2021-01-06 08:07

How can you read GZIP file in Android located in the \"ASSETS\" (or resources/raw) folder?

I have tried the following code, but my stream size is always 1.



        
6条回答
  •  爱一瞬间的悲伤
    2021-01-06 08:30

    I met the same problem when reading a gz file from assets folder.

    It's caused by the file name of the gz file. Just renaming yourfile.gz to other name like yourfile.bin. It seems Android build system would decompress a file automatically if it thought it's a gz.

提交回复
热议问题