Android: 7zip a folder using Apache Commons Compress

匿名 (未验证) 提交于 2019-12-03 01:05:01

问题:

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)); 


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