问题描述
我尝试做这样的:
但我的RAR文件的一个无法DECOM pressed。
But one of my rar file cannot be decompressed.
日志:
01-01 17:41:32.121: E/AndroidRuntime(12799): FATAL EXCEPTION: Thread-771
01-01 17:41:32.121: E/AndroidRuntime(12799): java.lang.OutOfMemoryError
01-01 17:41:32.121: E/AndroidRuntime(12799): at com.github.junrar.unpack.ppm.SubAllocator.startSubAllocator(SubAllocator.java:146)
01-01 17:41:32.121: E/AndroidRuntime(12799): at com.github.junrar.unpack.ppm.ModelPPM.decodeInit(ModelPPM.java:216)
01-01 17:41:32.121: E/AndroidRuntime(12799): at com.github.junrar.unpack.Unpack.readTables(Unpack.java:656)
01-01 17:41:32.121: E/AndroidRuntime(12799): at com.github.junrar.unpack.Unpack.unpack29(Unpack.java:165)
01-01 17:41:32.121: E/AndroidRuntime(12799): at com.github.junrar.unpack.Unpack.doUnpack(Unpack.java:120)
01-01 17:41:32.121: E/AndroidRuntime(12799): at com.github.junrar.Archive.doExtractFile(Archive.java:500)
01-01 17:41:32.121: E/AndroidRuntime(12799): at com.github.junrar.Archive.extractFile(Archive.java:442)
01-01 17:41:32.121: E/AndroidRuntime(12799): at com.github.junrar.testutil.ExtractArchive.extractArchive(ExtractArchive.java:73)
01-01 17:41:32.121: E/AndroidRuntime(12799): at com.github.junrar.testutil.ExtractArchive.extractArchive(ExtractArchive.java:29)
01-01 17:41:32.121: E/AndroidRuntime(12799): at com.letusread.util.DeCompressUtil.deCompress(DeCompressUtil.java:140)
01-01 17:41:32.121: E/AndroidRuntime(12799): at com.letusread.activity.FileListActivity$7.run(FileListActivity.java:338)
01-01 17:41:32.121: E/AndroidRuntime(12799): at java.lang.Thread.run(Thread.java:856)
01-01 17:41:32.324: E/MobclickAgent(12799): onEndSession called before onStartSession
我的文件是DECOM pressed但我的应用程序崩溃!
其他文件可以DECOM pressed正确;
你能帮我解决这个错误?
I the file was decompressed but my apps has crashed!other files can be decompressed properly;can you help me to solve this error??
推荐答案
在事实上,它似乎是执行中的错误。这是我使用,以避免问题的解决方法:
In fact, it seems to be a bug of the implementation. This is the workaround I have used in order to avoid the problem:
在 com.github.junrar.unpack.ppm.ModelPPM.java 的,行196: MaxMB = unpackRead.getChar();
该方法的getchar
,在某些情况下,怪异,返回一个非常大的数字。这应该是由于破头或头选项不junrar支持。
the method getChar
, in some weird situations, return a very big number. It should be due to a broken header or a header option not supported by junrar.
我的解决方法是检查是否MaxMB均大于1,我一直在使用这种修复很长一段时间没有问题设置为1。
My workaround was to check if MaxMB was greater than 1 and set to 1. I've been using this fix for a long time without problems.
int MaxMB = 0;
if (reset) {
MaxMB = unpackRead.getChar();
if (MaxMB > 1) { //Workaround
MaxMB = 1;
}
}
这篇关于当OutOfMemoryError而我DECOM preSS RAR Android上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!