Repository

a7zip_XJ

An Android wrapper for 7-Zip (P7ZIP). Writing archives is not supported. Add the JitPack repository to your root build.gradle. maven { url 'https://jitpack.io' } Add A7Zip dependen · License unknown · Maintenance unknown

License
Unknown
Variant
groupId:artifactId
extract-lite
com.github.seven332.a7zip:extract-lite
extract
com.github.seven332.a7zip:extract

Specs

  • VariantgroupId:artifactId
  • extract-litecom.github.seven332.a7zip:extract-lite
  • extractcom.github.seven332.a7zip:extract

README

A7Zip

An Android wrapper for 7-Zip (P7ZIP).

Writing archives is not supported.

Download

  1. Add the JitPack repository to your root build.gradle.
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. Add A7Zip dependency to your application build.gradle.
dependencies {
    implementation "com.github.xiaojieonly.a7zip_XJ:extract:${version}"
    // implementation "com.github.xiaojieonly.a7zip_XJ:extract-lite:${version}"
}

Usage

  1. Load native libraries.
A7Zip.initialize(context);
  1. Open an archive.
InArchive archive = InArchive.open(new File("archive.7z"));
  1. Operate the archive.
// How many entries are there in the archive?
int number = archive.getNumberOfEntries();

for (int i = 0; i < number; i++) {
    // Get the path of the entry
    String path = archive.getEntryPath(i);
    // Extract the entry
    archive.extractEntry(i, new FileOutputStream(path));
}

// Close the archive
archive.close();

Variant

7-Zip supports so many formats that you might not need them all. The codecs are in native library, ProGuard can't shrink it. Unused codecs increase the size of the final APK. So A7Zip has some variants to reduce the drawback.

Variant groupId:artifactId Note
extract-lite com.github.seven332.a7zip:extract-lite Open 7z, Rar, Rar5, Zip
extract com.github.seven332.a7zip:extract Open all formats 7-Zip supported