Android:使用 Apache Commons Compress 7zip 文件夹 [英] Android: 7zip a folder using Apache Commons Compress
本文介绍了Android:使用 Apache Commons Compress 7zip 文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的 .gradle
中包含了以下内容:编译'org.apache.commons:commons-compress:1.8'
I have included the following in my .gradle
:
compile 'org.apache.commons:commons-compress:1.8'
我想压缩一个文件夹.我试过了
I want to 7zip a folder. I have tried
SevenZOutputFile sevenZOutput = new SevenZOutputFile(file);
SevenZArchiveEntry entry = sevenZOutput.createArchiveEntry(fileToArchive, name);
sevenZOutput.putArchiveEntry(entry);
sevenZOutput.write(contentOfEntry); //this is what I don't understand!!
sevenZOutput.closeArchiveEntry();
我需要一些帮助和协助才能完成上述任务.
I require some help and assistance in accomplishing the above task.
谢谢.
推荐答案
sevenZOutput.write(contentOfEntry);
替换为
sevenZOutput.write(Files.toByteArray(fileToArchive));
这篇关于Android:使用 Apache Commons Compress 7zip 文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文