


With a 7z file in place, I now turn to the adapted Groovy script that will extract the contents of this Guava.7z file.

The next series of screen snapshots show me using Windows 7-Zip installed on my laptop to compress the six PDFs available under the Guava Downloads page into a single 7z file called Guava.7z.Ĭontents Selected and Right-Click Menu to Compress to 7z Format To demonstrate the adapted Groovy code for uncompressing 7z files, I first need a 7z file that I can extract contents from. I adapt Dark Knight's Java code into a Groovy script in this post. Dark Knight's response indicates how to use Java with 7-Zip-JBinding to uncompress a 7z file. The 7-Zip page describes it as "a Java wrapper for 7-Zip C++ library" that "allows extraction of many archive formats using a very fast native library directly from Java through JNI." The 7z format is based on " LZMA and LZMA2 compression." Although there is an LZMA SDK available, it is easier to use the open source ( SourceForge) 7-Zip-JBinding project when manipulating 7-Zip files with Java.Ī good example of using Java with 7-Zip-JBinding to uncompress 7z files is available in the StackOverflow thread Decompress files with. Most of the source code is under the GNU LGPL license." More license information in available on the site along with information on the 7z format ("LZMA is default and general compression method of 7z format"). The 7-Zip page describes 7-Zip as "a file archiver with a high compression ratio." The page further adds, "7-Zip is open source software. The two primary objectives of this post are to demonstrate uncompressing 7-Zip files with Groovy and the handy 7-Zip-JBinding and to call out and demonstrate some key characteristics of Groovy as a scripting language. This post demonstrates a Groovy script for uncompressing files with the 7-Zip archive format.
