Android: 7zip a folder using Apache Commons Compress

孤人 提交于 2020-01-06 02:46:07

问题


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.

Thanks.


回答1:


sevenZOutput.write(contentOfEntry);

replace to

sevenZOutput.write(Files.toByteArray(fileToArchive));


来源:https://stackoverflow.com/questions/36282358/android-7zip-a-folder-using-apache-commons-compress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!