http://www.7-zip.org/sdk.html This site provide a LZMA SDK for compress/decompress files, I would like to give it a shot but I am lost.
Anyone got experience on this? Or a tutorial? Thanks.
http://www.7-zip.org/sdk.html This site provide a LZMA SDK for compress/decompress files, I would like to give it a shot but I am lost.
Anyone got experience on this? Or a tutorial? Thanks.
Use J7Zip. Its a java port of the LZMA SDK. You find it here:
http://sourceforge.net/projects/p7zip/files/J7Zip/
alternative
Use the lzmajio.jar with LzmaInputStream and LzmaOutputStream classes
you find it on github:
http://github.com/league/lzmajio/downloads
Check out the LzmaAlone.java and LzmaBench.java files in the Java/SevenZip folder of the zip file from that link you posted.
Short answer: don't
The 7zip sdk is old and unmaintained and it's just a JNI wrapper around the C++ library. A pure Java implementation on a modern JVM (1.7+) is as fast as a C++ one and has less dependecies and portability issues.
Have a look at http://tukaani.org/xz/java.html
XZ is a file format based on LZMA2 (an improved version of LZMA)
The guys that invented the XZ format build a pure java implementation of the XZ archive compression / extraction algorithms
The XZ file format is designed to store 1 file only. Thus you need to zip/tar the source folder(s) into a single uncompressed file first.
Using the java library is as easy as this:
Here are tested examples of using XZ Utils pure java library to pack and unpack XZ archives with LZMA2 compression algorithm with great ratio.
You can use this library instead. It is "outdated" but still works fine.
Maven dependency
Utility class
Firstly you have to create a file with content to start compressing. You can use this website to generate random text.
Example compression and decompression