7 zip files (lzma) format, want to compress and encrypt.
I want to use Apache Commons Compress.
I am using this function, however, the decompressed files are corrupted.
Thanks
public static void main(String args[]) throws FileNotFoundException, IOException {
SevenZOutputFile sevenZOutput = new SevenZOutputFile(new File("outFile.7z"));
File entryFile = new File("D:/image.jpg");
SevenZArchiveEntry entry = sevenZOutput.createArchiveEntry(entryFile, entryFile.getName());
byte fileContent[] = new byte[(int)entryFile.length()];
sevenZOutput.putArchiveEntry(entry);
sevenZOutput.write(fileContent);
sevenZOutput.closeArchiveEntry();
sevenZOutput.close();
}