Simple compressing and decompressing command-line tools using Apache Commons Compress. You can use them as source code examples too.
Run the command-line tools without parameters to see the usage description:
$ java -cp commons-compress-1.18.jar:. untar
Usage: untar l|x <input archive> [output directory]
$ java -cp commons-compress-1.18.jar:. unzip
Usage: unzip l|x <input archive> [output directory]
$ java -cp commons-compress-1.18.jar:. tar
Usage: tar <output archive> [input directory]
$ java -cp commons-compress-1.18.jar:. zip
Usage: zip <output archive> [input directory]
List contents of a TAR.GZ archive:
$ java -cp commons-compress-1.18.jar:. untar l commons-compress-1.18-bin.tar.gz
File "commons-compress-1.18/LICENSE.txt"
...
Uncompress a ZIP archive to the current directory:
$ java -cp commons-compress-1.18.jar:. unzip x commons-compress-1.18-bin.zip .
Unpacking "commons-compress-1.18/LICENSE.txt"...
...
Compress a TAR archive of the current directory:
$ java -cp commons-compress-1.18.jar:. tar test.tar
Packing "./LICENSE"...
...
Make sure, that you installed OpenJDK Java and GNU Make or compatibles. The following command will download the common-compress
package and build the command line tools:
make all
The following command will test, that the command-line tools work:
make test
The following command will remove build and test output files:
make clean
The following command will remove all files created by the Makefile
, including the downloaded commons-compress
package:
make distclean
In lieu of a formal styleguide, take care to maintain the existing coding style.
Copyright (c) 2019 Ferdinand Prantl
Licensed under the Apache 2.0 license.