Skip to content
Snippets Groups Projects
README 2.87 KiB
Newer Older
Lasse Collin's avatar
Lasse Collin committed

XZ for Java
===========
Lasse Collin's avatar
Lasse Collin committed

Introduction

Lasse Collin's avatar
Lasse Collin committed
    This aims to be a complete implementation of XZ data compression
    in pure Java. Features:
      - Full support for the .xz file format specification version 1.0.4
      - Single-threaded streamed compression and decompression
      - Single-threaded decompression with limited random access support
      - Raw streams (no .xz headers) for advanced users, including LZMA2
        with preset dictionary

    Threading is planned but it is unknown when it will be implemented.
Lasse Collin's avatar
Lasse Collin committed

    For the latest source code, see the project home page:
Lasse Collin's avatar
Lasse Collin committed

        https://tukaani.org/xz/java.html
Lasse Collin's avatar
Lasse Collin committed

Lasse Collin's avatar
Lasse Collin committed
    The source code is compatible with Java 5 and later (except
    module-info.java which is Java 9 or later). However, the default
    build options require OpenJDK 11 or later, and create Java 7
    compatible binaries.
Lasse Collin's avatar
Lasse Collin committed

Lasse Collin's avatar
Lasse Collin committed
Building with Apache Ant
Lasse Collin's avatar
Lasse Collin committed

Lasse Collin's avatar
Lasse Collin committed
    Type "ant" to compile the classes and create the .jar files.
    Type "ant doc" to build the javadoc HTML documentation. Note
    that building the documentation will download a small file named
    "element-list" or "package-list" from Oracle to enable linking to
    the documentation of the standard Java classes.
Lasse Collin's avatar
Lasse Collin committed

Lasse Collin's avatar
Lasse Collin committed
    If you are using Ant older than 1.9.8:
Lasse Collin's avatar
Lasse Collin committed
        Edit build.xml and remove the release attributes from <javac>
        tags, that is, remove all occurrences of these two lines:

            release="${sourcever}"

            release="${sourcever9}"

        The downside of the above is that then -source and -target
        options will be used instead of --release.

    If you are using OpenJDK version older than 11:

        Adjust extdoc_url and extdoc_file to point to an older URL
        and to use "package-list" instead of "element-list". This
        modification isn't required if the documentation won't be
        built.

    If you are using OpenJDK version older than 9:

        Comment the sourcever9 line in the file build.properties.
        When it is commented, module-info.java won't be built and
        xz.jar won't be a modular JAR.

    If you are using OpenJDK version older than 7:

        In build.properties, set "sourcever = 5" or "sourcever = 6"
        to be compatible with Java 5 or 6.

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 (Java >= 9) compile also src9/module-info.java.
Lasse Collin's avatar
Lasse Collin committed

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
Lasse Collin's avatar
Lasse Collin committed

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

Lasse Collin's avatar
Lasse Collin committed
        java -jar build/jar/XZDecDemo.jar foo.txt.xz
Lasse Collin's avatar
Lasse Collin committed

Reporting bugs

    Report bugs to <lasse.collin@tukaani.org> or visit the IRC channel
    #tukaani on Freenode and talk to Larhzu.