Taw*_*ani 5 android gzip android-assets gzipinputstream
如何读取 Android 中位于“ASSETS”(或 resources/raw)文件夹中的 GZIP 文件?
我尝试过以下代码,但我的流大小始终为 1。
GZIPInputStream fIn = new GZIPInputStream(mContext.getResources().openRawResource(R.raw.myfilegz));
int size = fIn.available();
Run Code Online (Sandbox Code Playgroud)
由于某种原因,大小始终为 1。但如果我不对该文件进行 GZIP,它就可以正常工作。
注意: 使用Android 1.5
AssetManager如果您使用而不是会发生什么Resources?例子:
InputStream is = mContext.getAssets().open("myfilegz");
GZIPInputStream fIn = new GZIPINputStream(is);
Run Code Online (Sandbox Code Playgroud)
在内部,Resources只是调用AssetManager;我想知道在这个过程中是否会在某个地方把事情搞乱。
| 归档时间: |
|
| 查看次数: |
15301 次 |
| 最近记录: |