问题
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