Decompress Rar file in Android

前端 未结 2 1522
庸人自扰
庸人自扰 2021-02-10 07:02

I want to learn how to decompress a .rar file in android. Zip files can be easily decompressed using ZipStream. Is there any similar way for rar files.

2条回答
  •  误落风尘
    2021-02-10 07:51

    I just realized this with jUnrar from here https://github.com/edmund-wagner/junrar

    Create a new package within your Android src directory called com.github.junrar You should delete com.github.junrar.vfs2 because it has some dependencies and you probably won't use it anyway.

    You will probably get some errors about the logger class. You can either remove the few logging lines or like i did write a tiny wrapper which communicates with android.util.Log. I did that and changed the includes.

    If you finished importing the code take a look at jUnrars testutils. I used this and it worked out of the box:

    https://github.com/edmund-wagner/junrar/blob/master/testutil/src/main/java/com/github/junrar/testutil/ExtractArchive.java

    Hope it helps

提交回复
热议问题