# Mzip-Android
**Repository Path**: vw12_admin/Mzip-Android
## Basic Information
- **Project Name**: Mzip-Android
- **Description**: An Android compress and extract library support popular compression format such as rar, zip
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-03-23
- **Last Updated**: 2021-03-23
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
[](https://badge.fury.io/gh/ghost1372%2FMzip-Android)
# Mzip-Android
An Android compress and extract library support popular compression format such as rar, zip
that support android api >= 14 (may work >=9 not tested) also tested on android 7.1.1
# ABOUT The LIBRARY....
The simple and useful library for android app developers to read/write archives like zip , rar.
I needed compressing files for a project, Because I could not find a good and thorough library I wrote a nearly complete library.
Other open source projects have been used to write this library.
# Supported formats
.zip
.rar (extract only ,may you can find a method to create look ir.mahdi.mzip.rar classes)
# Download
You can use Gradle:
```gradle
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compile 'com.github.ghost1372:Mzip-Android:0.4.0'
}
```
Or Maven:
# Step 1. Add the JitPack repository to your build file
```xml
jitpack.io
https://jitpack.io
```
# Step 2. Add the dependency
```xml
com.github.ghost1372
Mzip-Android
0.4.0
```
# How do I use MZip?
Zip:
```java
ZipArchive zipArchive = new ZipArchive();
zipArchive.zip(targetPath,destinationPath,password);
//Example
ZipArchive zipArchive = new ZipArchive();
zipArchive.zip("/sdcard/file.pdf","/sdcard/file.zip,"");
//if you want protect with password
zipArchive.zip("/sdcard/file.pdf","/sdcard/file.zip,"123456 or anything you want");
```
Unzip
```java
ZipArchive zipArchive = new ZipArchive();
zipArchive.unzip(targetPath,destinationPath,password);
//Example
ZipArchive zipArchive = new ZipArchive();
zipArchive.unzip("/sdcard/file.zip","/sdcard/folder","");
//if your file protected with password
zipArchive.unzip("/sdcard/file.zip","/sdcard/folder","123456 or anything you want");
```
If your file does not have a password, Leave it blank.
Rar:
```java
RarArchive rarArchive = new RarArchive();
rarArchive.extractArchive(file archive, file destination);
//OR use String path
rarArchive.extractArchive(string archive, string destination);
//Example
RarArchive rarArchive = new RarArchive();
rarArchive.extractArchive("/sdcard/file.rar","/sdcard/folder");
```
for other various format you can use RarArchive class and extractArchive function it must be work with tar and other formats.