tukaani-project / xz-java

XZ for Java
https://tukaani.org/xz/java.html
BSD Zero Clause License
23 stars 14 forks source link

XZ for Java

Introduction

XZ for Java aims to be a complete implementation of XZ data compression in pure Java.

Features:

Building with Apache Ant

All output files go into the build directory.

Reproducible builds

Reproducible builds should be possible. A timestamp needs to be specified which will be used for file modification times in the JAR metadata. The timestamps are stored using the local timezone, thus it's good to override it to GMT/UTC. On POSIX systems, the following commands are equivalent:

$ ANT_OPTS=-Duser.timezone=GMT \
      ant -Dant.tstamp.now.iso=2024-07-29T14:10:26Z

$ SOURCE_DATE_EPOCH=1722262226 TZ=UTC0 ant

When the Git repository is available, using the committer date is one way to get a reasonable value:

$ SOURCE_DATE_EPOCH=$(git log -n1 --pretty=%ct) TZ=UTC0 ant

Old build environments

Building without Apache Ant

If you cannot or don't want to use Ant, just compile all .java files under the src directory (possibly skip the demo files src/*.java). For module support and speed optimizations (Java >= 9), compile also all .java files under the src9 directory.

Demo programs

You can test compression with XZEncDemo, which compresses from standard input to standard output:

java -jar build/jar/XZEncDemo.jar < foo.txt > foo.txt.xz

You can test decompression with XZDecDemo, which decompresses to standard output:

java -jar build/jar/XZDecDemo.jar foo.txt.xz

Contact information