मुझे यह page मिला जो एक विकल्प प्रदान करता है जो एक आकर्षण की तरह काम करता है। आपको केवल compile 'org.apache.commons:commons-compress:1.8'
अपनी बिल्ड ग्रेबल स्क्रिप्ट में जोड़ना होगा और अपनी इच्छित सुविधा का उपयोग करना होगा। इस मुद्दे के लिए मैंने निम्नलिखित किया:
AssetManager am = getAssets();
InputStream inputStream = null;
try {
inputStream = am.open("a7ZipedFile.7z");
File file1 = createFileFromInputStream(inputStream);
} catch (IOException e) {
e.printStackTrace();
}
SevenZFile sevenZFile = null;
try{
File f = new File(this.getFilesDir(), "a7ZipedFile.7z");
OutputStream outputStream = new FileOutputStream(f);
byte buffer[] = new byte[1024];
int length = 0;
while((length=inputStream.read(buffer)) > 0) {
outputStream.write(buffer,0,length);
}
try {
sevenZFile = new SevenZFile(f);
SevenZArchiveEntry entry = sevenZFile.getNextEntry();
while (entry != null) {
System.out.println(entry.getName());
FileOutputStream out = openFileOutput(entry.getName(), Context.MODE_PRIVATE);
byte[] content = new byte[(int) entry.getSize()];
sevenZFile.read(content, 0, content.length);
out.write(content);
out.close();
entry = sevenZFile.getNextEntry();
}
sevenZFile.close();
outputStream.close();
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}catch (IOException e) {
//Logging exception
e.printStackTrace();
}
आयातित लाइब्रेरी के लिए केवल एक ही ड्रा वापस 200k है। इसके अलावा इसका उपयोग करना वास्तव में आसान है।
7-ज़िप ट्यूटोरियल की एक सूची this page के नीचे है। – gregS
उत्तर के लिए धन्यवाद, लेकिन 7zip पेज पर लिंक काफी पुराने हैं और मेरे लिए उपयोग योग्य नहीं हैं। मैंने इस प्रश्न को दूसरे में फंसाया: http://stackoverflow.com/questions/3469904/ – Wolkenjaeger
आप शायद एंड्रॉइडप्लोरर v.3 पर एक नज़र डालना चाहते हैं। यह 7z सहित कई फ़ाइल प्रारूपों का समर्थन करता है। – Yongki