Compressed Resources

For each of the supported compression formats there is a correspondig resource that wraps around another resource providing compression or decompression on the fly. A single element resource collection must be specified as a nested element.

Resources for the formats that support files holding multiple compressed streams (bzip2, gzip, lz4 and xz) support a boolean attribute decompressConcatenated. If set to true all streams will be concatenated and treated as a single resource. With the default value false only the first stream is uncompressed.

brotliresource

This is a compressed resource using the Brotli compression.

Since Compress Antlib 1.5

Examples

<cmp:tarentry xmlns:cmp="antlib:org.apache.ant.compress"
    name="some-file.txt">
  <cmp:brotliresource>
    <file file="some-archive.tar.br"/>
  </cmp:brotliresource>
</cmp:tarentry>

Represents the entry named some-file.txt in archive some-archive.tar.br where the brotliresource provides the decompression of the archive.

bzip2resource

This is a compressed resource using the BZIP2 compression.

This resource supports the decompressConcatenated attribute.

Examples

<cmp:tarentry xmlns:cmp="antlib:org.apache.ant.compress"
    name="some-file.txt">
  <cmp:bzip2resource>
    <file file="some-archive.tar.bz2"/>
  </cmp:bzip2resource>
</cmp:tarentry>

Represents the entry named some-file.txt in archive some-archive.tar.bz2 where the bzip2resource provides the decompression of the archive.

deflateresource

Since Apache Compress Antlib 1.5.

This is a compressed resource using the DEFLATE compression.

This resource supports the following additional attributes:

Attribute Description Required
zlibheader Whether to write or expect ZLIB headers. Unfortunately it is currently not possible to detect whether zlib headers have been used when reading. No, defaults to true

gzipresource

This is a compressed resource using the GZIP compression.

This resource supports the decompressConcatenated attribute.

Examples

<cmp:tarentry xmlns:cmp="antlib:org.apache.ant.compress"
    name="some-file.txt">
  <cmp:gzipresource>
    <file file="some-archive.tar.gz"/>
  </cmp:gzipresource>
</cmp:tarentry>

Represents the entry named some-file.txt in archive some-archive.tar.gz where the gzipresource provides the decompression of the archive.

lz4resource

Since Apache Compress Antlib 1.5.

This is a compressed resource using the LZ4 compression.

This resource supports the decompressConcatenated attribute if the frame format is used.

Parameters

In addition to the attributes supported by all uncompressing resources this resource also supports.

Attribute Description Required
framed Whether the input is expected to use the frame format. No, defaults to true.

Examples

<cmp:tarentry xmlns:cmp="antlib:org.apache.ant.compress"
    name="some-file.txt">
  <cmp:lz4resource>
    <file file="some-archive.tar.lz4"/>
  </cmp:lz4resource>
</cmp:tarentry>

Represents the entry named some-file.txt in archive some-archive.tar.lz4 where the lz4resource provides the decompression of the archive.

lzmaresource

Since Apache Compress Antlib 1.3.

This is a compressed resource using the LZMA compression.

Examples

<cmp:tarentry xmlns:cmp="antlib:org.apache.ant.compress"
    name="some-file.txt">
  <cmp:lzmaresource>
    <file file="some-archive.tar.lzma"/>
  </cmp:lzmaresource>
</cmp:tarentry>

Represents the entry named some-file.txt in archive some-archive.tar.lzma where the lzmaresource provides the decompression of the archive.

pack200resource

This is a compressed resource using the Pack200 compression.

Examples

<cmp:zipentry xmlns:cmp="antlib:org.apache.ant.compress"
    name="SomeFile.class">
  <cmp:pack200resource>
    <file file="some-archive.pack"/>
  </cmp:pack200resource>
</cmp:zipentry>

Represents the entry named Somefile.class in the Pack200 compressed JAR some-archive.pack where the pack200resource provides the decompression of the archive.

snappyresource

Since Apache Compress Antlib 1.4.

This is a compressed resource using the Snappy compression.

Parameters

In addition to the attributes supported by all uncompressing resources this resource also supports.

Attribute Description Required
framed Whether the input is expected to use the framing format. No, defaults to true.

Examples

<cmp:tarentry xmlns:cmp="antlib:org.apache.ant.compress"
    name="some-file.txt">
  <cmp:snappyresource>
    <file file="some-archive.tar.sz"/>
  </cmp:snappyresource>
</cmp:tarentry>

Represents the entry named some-file.txt in archive some-archive.tar.sz where the snappyresource provides the decompression of the archive.

xzresource

This is a compressed resource using the XZ compression.

This resource supports the decompressConcatenated attribute.

Examples

<cmp:tarentry xmlns:cmp="antlib:org.apache.ant.compress"
    name="some-file.txt">
  <cmp:xzresource>
    <file file="some-archive.tar.xz"/>
  </cmp:xzresource>
</cmp:tarentry>

Represents the entry named some-file.txt in archive some-archive.tar.xz where the xzresource provides the decompression of the archive.

zresource

Since Apache Compress Antlib 1.4.

This is a compressed resource using the traditional Unix compress (.Z) compression.

Examples

<cmp:tarentry xmlns:cmp="antlib:org.apache.ant.compress"
    name="some-file.txt">
  <cmp:zresource>
    <file file="some-archive.tar.Z"/>
  </cmp:zresource>
</cmp:tarentry>

Represents the entry named some-file.txt in archive some-archive.tar.Z where the zresource provides the decompression of the archive.