You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2017/05/14 20:42:33 UTC
[01/12] ant-antlibs-compress git commit: ivy.xml didn't mention snappy
Repository: ant-antlibs-compress
Updated Branches:
refs/heads/master 3472e109d -> 9668aba32
ivy.xml didn't mention snappy
Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/21789f1e
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/21789f1e
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/21789f1e
Branch: refs/heads/master
Commit: 21789f1e6a402b5c567ab464694a05af28104841
Parents: 3472e10
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 06:07:58 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 06:07:58 2017 +0200
----------------------------------------------------------------------
ivy.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/21789f1e/ivy.xml
----------------------------------------------------------------------
diff --git a/ivy.xml b/ivy.xml
index 87c0722..3d32abb 100644
--- a/ivy.xml
+++ b/ivy.xml
@@ -28,8 +28,8 @@
url="http://ant.apache.org/"/>
<description homepage="http://ant.apache.org/antlibs/compress/">
Provides tasks and types that deal with AR, ARJ, CPIO, TAR,
- DUMP, 7Z and ZIP archives as well as BZIP2, PACK200, GZIP, LZMA
- and XZ compressed files based on Apache Commons Compress.
+ DUMP, 7Z and ZIP archives as well as BZIP2, PACK200, GZIP, LZMA,
+ Snappy and XZ compressed files based on Apache Commons Compress.
</description>
</info>
<configurations>
[06/12] ant-antlibs-compress git commit: add LZ4 support
Posted by bo...@apache.org.
add LZ4 support
Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/cfb57edd
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/cfb57edd
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/cfb57edd
Branch: refs/heads/master
Commit: cfb57edd234130281229103cabc4fc24d2d49ebd
Parents: fefec90
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 17:11:29 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 17:11:29 2017 +0200
----------------------------------------------------------------------
changes.xml | 5 +-
docs/compresource.html | 46 +++++++-
docs/index.html | 11 +-
docs/pack.html | 27 +++++
docs/unpack.html | 31 +++++-
ivy.xml | 2 +-
src/main/org/apache/ant/compress/antlib.xml | 12 ++
.../ant/compress/resources/LZ4Resource.java | 50 +++++++++
.../org/apache/ant/compress/taskdefs/LZ4.java | 56 ++++++++++
.../org/apache/ant/compress/taskdefs/UnLZ4.java | 45 ++++++++
.../ant/compress/util/LZ4StreamFactory.java | 95 ++++++++++++++++
src/tests/antunit/lz4-test.xml | 109 +++++++++++++++++++
src/tests/antunit/lz4resource-test.xml | 79 ++++++++++++++
src/tests/antunit/unlz4-test.xml | 105 ++++++++++++++++++
src/tests/resources/asf-logo.gif.lz4 | Bin 0 -> 7007 bytes
src/tests/resources/multiple.lz4 | Bin 0 -> 40 bytes
16 files changed, 665 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/changes.xml
----------------------------------------------------------------------
diff --git a/changes.xml b/changes.xml
index 014c051..085cbcd 100644
--- a/changes.xml
+++ b/changes.xml
@@ -40,7 +40,7 @@
<release version="1.5" date="unreleased">
<action type="update" breaks-bwc="true">
The Apache Compress Antlib now requires Apache Commons
- Compress 1.14 or later for 7z, DEFLATE and write support
+ Compress 1.14 or later for 7z, DEFLATE, LZ4 and write support
for LZMA and Snappy.
XZ for Java 1.6 is required for write support for LZMA.
</action>
@@ -66,6 +66,9 @@
<action type="add">
Added write support for the Snappy format.
</action>
+ <action type="add">
+ Added support for the LZ4 format.
+ </action>
</release>
<release version="1.4" date="2014-01-29">
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/docs/compresource.html
----------------------------------------------------------------------
diff --git a/docs/compresource.html b/docs/compresource.html
index 50dc979..3091c72 100644
--- a/docs/compresource.html
+++ b/docs/compresource.html
@@ -33,7 +33,7 @@
<a name="decompressConcatenated">
<p>Resources for the formats that support files holding multiple
- compressed streams (bzip2, gzip and xz) support a boolean attribute
+ 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.</p>
@@ -111,6 +111,50 @@
some-archive.tar.gz where the <code>gzipresource</code> provides
the decompression of the archive.</p>
+<h2><a name="lz4resource">lz4resource</a></h2>
+
+<p><em>Since Apache Compress Antlib 1.5</em>.</p>
+
+<p>This is a <a href="#compresource">compressed resource</a> using the
+ LZ4 compression.</p>
+
+<p>This resource supports
+ the <a href="#decompressConcatenated">decompressConcatenated</a>
+ attribute if the frame format is used.</p>
+
+<h4>Parameters</h4>
+ <p>In addition to the attributes supported by all uncompressing resources
+ this resource also supports.</p>
+ <table border="1" cellpadding="2" cellspacing="0">
+ <tr>
+ <td valign="top"><b>Attribute</b></td>
+ <td valign="top"><b>Description</b></td>
+ <td align="center" valign="top"><b>Required</b></td>
+ </tr>
+ <tr>
+ <td valign="top">framed</td>
+ <td valign="top">Whether the input is expected to use
+ the <a href="http://lz4.github.io/lz4/lz4_Frame_format.html">frame
+ format</a>.</td>
+ <td align="center" valign="top">No, defaults to true.</td>
+ </tr>
+ </table>
+
+<h4>Examples</h4>
+
+<pre>
+<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>
+</pre>
+
+<p>Represents the entry named some-file.txt in archive
+ some-archive.tar.lz4 where the <code>lz4resource</code> provides
+ the decompression of the archive.</p>
+
<h2><a name="lzmaresource">lzmaresource</a></h2>
<p><em>Since Apache Compress Antlib 1.3</em>.</p>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/docs/index.html
----------------------------------------------------------------------
diff --git a/docs/index.html b/docs/index.html
index f7e2c4b..c249f43 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -28,10 +28,10 @@
<p>This Antlib contains tasks and resources that provide
compression/uncompression and archival/unarchival capabilities
based on <a href="http://commons.apache.org/compress/">Apache
- Commons Compress</a>. Using Apache Commons Compress 1.13 this
- Antlib supports gzip, bzip2, lzma standalone, xz, .Z, DEFLATE, Snappy and
- pack200 compression and ar, arj, cpio, 7z, Unix dump, tar and
- zip archives. Support for arj, .Z and dump is
+ Commons Compress</a>. Using Apache Commons Compress 1.14 this
+ Antlib supports gzip, bzip2, lzma standalone, xz, .Z, DEFLATE,
+ Snappy, LZ4 and pack200 compression and ar, arj, cpio, 7z, Unix
+ dump, tar and zip archives. Support for arj, .Z and dump is
read-only. 7z can only be used on filesystem resources.</p>
<h3>Known Limitations</h3>
@@ -52,6 +52,7 @@
<li><a href="pack.html#deflate">deflate</a></li>
<li><a href="unpack.html#gunzip">gunzip</a></li>
<li><a href="pack.html#gzip">gzip</a></li>
+ <li><a href="pack.html#lz4">lz4</a></li>
<li><a href="pack.html#lzma">lzma</a></li>
<li><a href="pack.html#pack200">pack200</a></li>
<li><a href="pack200normalize.html">pack200normalize</a></li>
@@ -64,6 +65,7 @@
<li><a href="expand.html#uncpio">uncpio</a></li>
<li><a href="unpack.html#undeflate">undeflate</a></li>
<li><a href="expand.html#undump">undump</a></li>
+ <li><a href="unpack.html#unlz4">unlz4</a></li>
<li><a href="unpack.html#unlzma">unlzma</a></li>
<li><a href="unpack.html#unpack200">unpack200</a></li>
<li><a href="unpack.html#unsnappy">unsnappy</a></li>
@@ -90,6 +92,7 @@
<li><a href="entry.html#dumpentry">dumpentry</a></li>
<li><a href="fileset.html#dumpfileset">dumpfileset</a></li>
<li><a href="compresource.html#gzipresource">gzipresource</a></li>
+ <li><a href="compresource.html#lz4resource">lz4resource</a></li>
<li><a href="compresource.html#lzmaresource">lzmaresource</a></li>
<li><a href="compresource.html#pack200resource">pack200resource</a></li>
<li><a href="compresource.html#snappyresource">snappyresource</a></li>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/docs/pack.html
----------------------------------------------------------------------
diff --git a/docs/pack.html b/docs/pack.html
index 39e9b10..2383102 100644
--- a/docs/pack.html
+++ b/docs/pack.html
@@ -151,6 +151,33 @@
</tr>
</table>
+ <h3><a name="lz4">LZ4</a></h3>
+
+ <p>Is a <a href="#pack">compressing task</a> that uses
+ the <a href="http://lz4.github.io/lz4/">LZ4</a> compression
+ algorithm.</p>
+
+ <p><em>Since Compress Antlib 1.5</em>
+
+ <h4>Parameters</h4>
+ <p>In addition to the attributes supported by all compressing task
+ this task also supports.</p>
+ <table border="1" cellpadding="2" cellspacing="0">
+ <tr>
+ <td valign="top"><b>Attribute</b></td>
+ <td valign="top"><b>Description</b></td>
+ <td align="center" valign="top"><b>Required</b></td>
+ </tr>
+ <tr>
+ <td valign="top">framed</td>
+ <td valign="top">Whether to use
+ the <a href="http://lz4.github.io/lz4/lz4_Frame_format.html">frame
+ format</a>.
+ </td>
+ <td align="center" valign="top">No, defaults to true.</td>
+ </tr>
+ </table>
+
<h3><a name="lzma">LZMA</a></h3>
<p>Is a <a href="#pack">compressing task</a> that uses the LZMA
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/docs/unpack.html
----------------------------------------------------------------------
diff --git a/docs/unpack.html b/docs/unpack.html
index 2b96a70..e36d97d 100644
--- a/docs/unpack.html
+++ b/docs/unpack.html
@@ -117,7 +117,36 @@ resource collection</h4>
</tr>
</table>
-<h3><a name="unlzma">UnLZMA</a></h3>
+<h3><a name="unlz4">UnLZ4</a></h3>
+
+<p>Is an <a href="#unpack">uncompressing task</a> that uses the LZ4
+ compression algorithm.</p>
+
+<p><em>Since Apache Compress Antlib 1.5</em>.</p>
+
+<p>This task supports
+ the <a href="#decompressConcatenated">decompressConcatenated</a>
+ attribute if the frame format is used.</p>
+
+<h4>Parameters</h4>
+ <p>In addition to the attributes supported by all uncompressing task
+ this task also supports.</p>
+ <table border="1" cellpadding="2" cellspacing="0">
+ <tr>
+ <td valign="top"><b>Attribute</b></td>
+ <td valign="top"><b>Description</b></td>
+ <td align="center" valign="top"><b>Required</b></td>
+ </tr>
+ <tr>
+ <td valign="top">framed</td>
+ <td valign="top">Whether the input is expected to use
+ the <a href="http://lz4.github.io/lz4/lz4_Frame_format.html">frame
+ format</a>.</td>
+ <td align="center" valign="top">No, defaults to true.</td>
+ </tr>
+ </table>
+
+ <h3><a name="unlzma">UnLZMA</a></h3>
<p>Is an <a href="#unpack">uncompressing task</a> that uses the LZMA
compression algorithm.</p>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/ivy.xml
----------------------------------------------------------------------
diff --git a/ivy.xml b/ivy.xml
index 65bf92b..4eadc03 100644
--- a/ivy.xml
+++ b/ivy.xml
@@ -29,7 +29,7 @@
<description homepage="http://ant.apache.org/antlibs/compress/">
Provides tasks and types that deal with AR, ARJ, CPIO, TAR,
DUMP, 7Z and ZIP archives as well as BZIP2, PACK200, GZIP, LZMA,
- Snappy and XZ compressed files based on Apache Commons Compress.
+ Snappy, LZ4 and XZ compressed files based on Apache Commons Compress.
</description>
</info>
<configurations>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/src/main/org/apache/ant/compress/antlib.xml
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/antlib.xml b/src/main/org/apache/ant/compress/antlib.xml
index 8f4ea91..00b762a 100644
--- a/src/main/org/apache/ant/compress/antlib.xml
+++ b/src/main/org/apache/ant/compress/antlib.xml
@@ -73,6 +73,10 @@
classname="org.apache.ant.compress.taskdefs.GUnzip"
/>
<taskdef
+ name="unlz4"
+ classname="org.apache.ant.compress.taskdefs.UnLZ4"
+ />
+ <taskdef
name="unlzma"
classname="org.apache.ant.compress.taskdefs.UnLZMA"
/>
@@ -125,6 +129,10 @@
classname="org.apache.ant.compress.taskdefs.XZ"
/>
<taskdef
+ name="lz4"
+ classname="org.apache.ant.compress.taskdefs.LZ4"
+ />
+ <taskdef
name="lzma"
classname="org.apache.ant.compress.taskdefs.LZMA"
/>
@@ -203,6 +211,10 @@
classname="org.apache.ant.compress.resources.GZipResource"
/>
<typedef
+ name="lz4resource"
+ classname="org.apache.ant.compress.resources.LZ4Resource"
+ />
+ <typedef
name="lzmaresource"
classname="org.apache.ant.compress.resources.LZMAResource"
/>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/src/main/org/apache/ant/compress/resources/LZ4Resource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/resources/LZ4Resource.java b/src/main/org/apache/ant/compress/resources/LZ4Resource.java
new file mode 100644
index 0000000..bcdedd0
--- /dev/null
+++ b/src/main/org/apache/ant/compress/resources/LZ4Resource.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ant.compress.resources;
+
+import org.apache.ant.compress.util.LZ4StreamFactory;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/**
+ * An LZ4 compressed resource.
+ * @since Apache Compress Antlib 1.5
+ */
+public final class LZ4Resource extends CommonsCompressCompressorResource {
+ private static final String NAME = "LZ4";
+
+ private final LZ4StreamFactory factory;
+
+ public LZ4Resource() {
+ super(NAME);
+ setFactory(factory = new LZ4StreamFactory());
+ }
+
+ public LZ4Resource(ResourceCollection other) {
+ super(NAME, other);
+ setFactory(factory = new LZ4StreamFactory());
+ }
+
+ /**
+ * Whether to use the "frame format".
+ *
+ * <p>Defaults to true.</p>
+ */
+ public void setFramed(boolean framed) {
+ factory.setFramed(framed);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/src/main/org/apache/ant/compress/taskdefs/LZ4.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/LZ4.java b/src/main/org/apache/ant/compress/taskdefs/LZ4.java
new file mode 100644
index 0000000..763d700
--- /dev/null
+++ b/src/main/org/apache/ant/compress/taskdefs/LZ4.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.ant.compress.taskdefs;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.ant.compress.resources.LZ4Resource;
+import org.apache.ant.compress.resources.CommonsCompressCompressorResource;
+import org.apache.ant.compress.util.LZ4StreamFactory;
+import org.apache.tools.ant.types.Resource;
+
+/**
+ * Compresses using LZ4.
+ * @since Apache Compress Antlib 1.5
+ */
+public final class LZ4 extends PackBase {
+
+ private final LZ4StreamFactory factory;
+
+ public LZ4() {
+ super(new PackBase.ResourceWrapper() {
+ @Override
+ public CommonsCompressCompressorResource wrap(Resource dest) {
+ return new LZ4Resource(dest);
+ }
+ });
+ setFactory(factory = new LZ4StreamFactory());
+ }
+
+ /**
+ * Whether to use the "frame format".
+ *
+ * <p>Defaults to true.</p>
+ */
+ public void setFramed(boolean framed) {
+ factory.setFramed(framed);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/src/main/org/apache/ant/compress/taskdefs/UnLZ4.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/UnLZ4.java b/src/main/org/apache/ant/compress/taskdefs/UnLZ4.java
new file mode 100644
index 0000000..079280b
--- /dev/null
+++ b/src/main/org/apache/ant/compress/taskdefs/UnLZ4.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.ant.compress.taskdefs;
+
+import org.apache.ant.compress.util.LZ4StreamFactory;
+
+/**
+ * Expands an LZ4 archive.
+ * @since Apache Compress Antlib 1.5
+ */
+public final class UnLZ4 extends UnpackBase {
+
+ private final LZ4StreamFactory factory;
+
+ public UnLZ4() {
+ super(".lz4");
+ setFactory(factory = new LZ4StreamFactory());
+ }
+
+ /**
+ * Whether to use the "frame format".
+ *
+ * <p>Defaults to true.</p>
+ */
+ public void setFramed(boolean framed) {
+ factory.setFramed(framed);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/src/main/org/apache/ant/compress/util/LZ4StreamFactory.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/util/LZ4StreamFactory.java b/src/main/org/apache/ant/compress/util/LZ4StreamFactory.java
new file mode 100644
index 0000000..59fb360
--- /dev/null
+++ b/src/main/org/apache/ant/compress/util/LZ4StreamFactory.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.ant.compress.util;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.commons.compress.compressors.CompressorInputStream;
+import org.apache.commons.compress.compressors.CompressorOutputStream;
+import org.apache.commons.compress.compressors.lz4.BlockLZ4CompressorInputStream;
+import org.apache.commons.compress.compressors.lz4.BlockLZ4CompressorOutputStream;
+import org.apache.commons.compress.compressors.lz4.FramedLZ4CompressorInputStream;
+import org.apache.commons.compress.compressors.lz4.FramedLZ4CompressorOutputStream;
+
+/**
+ * Creates streams for LZ4 format.
+ * @since Apache Compress Antlib 1.5
+ * @see <a href="http://lz4.github.io/lz4/">LZ4 Project</a>
+ */
+public class LZ4StreamFactory implements CompressorWithConcatenatedStreamsFactory {
+
+ private boolean framed = true;
+
+ /**
+ * Whether to use the "frame format".
+ *
+ * <p>Defaults to true.</p>
+ */
+ public void setFramed(boolean framed) {
+ this.framed = framed;
+ }
+
+ /**
+ * Whether to use the "frame format".
+ */
+ protected boolean isFramed() {
+ return framed;
+ }
+
+ /**
+ * @param stream the stream to read from, should be buffered
+ */
+ @Override
+ public CompressorInputStream getCompressorStream(InputStream stream)
+ throws IOException {
+ return framed ? new FramedLZ4CompressorInputStream(stream)
+ : (CompressorInputStream) new BlockLZ4CompressorInputStream(stream);
+ }
+
+ /**
+ * @param stream the stream to read from, should be buffered
+ * @param decompressConcatenated
+ * if true, decompress until the end of the
+ * input; if false, stop after the first
+ * stream
+ */
+ @Override
+ public CompressorInputStream getCompressorStream(InputStream stream,
+ boolean decompressConcatenated)
+ throws IOException {
+ if (!framed && decompressConcatenated) {
+ throw new UnsupportedOperationException("only the frame format supports"
+ + " concatenated streams");
+ }
+ return framed ? new FramedLZ4CompressorInputStream(stream, decompressConcatenated)
+ : (CompressorInputStream) new BlockLZ4CompressorInputStream(stream);
+ }
+
+ /**
+ * @param stream the stream to write to, should be buffered
+ */
+ @Override
+ public CompressorOutputStream getCompressorStream(OutputStream stream)
+ throws IOException {
+ return framed ? new FramedLZ4CompressorOutputStream(stream)
+ : (CompressorOutputStream) new BlockLZ4CompressorOutputStream(stream);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/src/tests/antunit/lz4-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/lz4-test.xml b/src/tests/antunit/lz4-test.xml
new file mode 100644
index 0000000..c1cc22d
--- /dev/null
+++ b/src/tests/antunit/lz4-test.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<project default="antunit"
+ xmlns:au="antlib:org.apache.ant.antunit"
+ xmlns:cond="antlib:org.apache.tools.ant.types.conditions"
+ xmlns:cmp="antlib:org.apache.ant.compress">
+
+ <import file="antunit-base.xml" />
+
+ <target name="setUp">
+ <mkdir dir="${output}" />
+ <mkdir dir="${output}/empty" />
+ <touch file="${output}/fileone" />
+ <touch file="${output}/filetwo" />
+ </target>
+
+ <target name="testFailNone" depends="setUp">
+ <au:expectfailure expectedmessage="source is required.">
+ <cmp:lz4 destfile="${output}/file.lz4">
+ <fileset dir="${output}/empty" />
+ </cmp:lz4>
+ </au:expectfailure>
+ </target>
+
+ <target name="testFailTwo" depends="setUp">
+ <au:expectfailure expectedmessage="Can only have one source.">
+ <cmp:lz4 destfile="${output}/file.lz4">
+ <fileset dir="${output}" />
+ </cmp:lz4>
+ </au:expectfailure>
+ </target>
+
+ <target name="testFailNoDest" depends="setUp">
+ <au:expectfailure expectedmessage="dest resource is required.">
+ <cmp:lz4 src="${output}/fileone">
+ <dest>
+ <fileset dir="${output}/empty" />
+ </dest>
+ </cmp:lz4>
+ </au:expectfailure>
+ </target>
+
+ <target name="testFailTwoDests" depends="setUp">
+ <au:expectfailure expectedmessage="Can only have one destination resource.">
+ <cmp:lz4 src="${output}/fileone">
+ <dest>
+ <fileset dir="${output}" />
+ </dest>
+ </cmp:lz4>
+ </au:expectfailure>
+ </target>
+
+ <target name="testRealTest" depends="setUp">
+ <cmp:lz4 src="../resources/asf-logo.gif"
+ destfile="${output}/asf-logo.gif.lz4" />
+ <au:assertLogContains text="Building: asf-logo.gif.lz4"/>
+ <au:assertFileExists file="${output}/asf-logo.gif.lz4"/>
+ </target>
+
+ <target name="testRealTestWithResource" depends="setUp">
+ <cmp:lz4 destfile="${output}/asf-logo.gif.lz4">
+ <file file="../resources/asf-logo.gif"/>
+ </cmp:lz4>
+ <au:assertLogContains text="Building: asf-logo.gif.lz4"/>
+ <au:assertFileExists file="${output}/asf-logo.gif.lz4"/>
+ </target>
+
+ <target name="testDateCheck" depends="setUp">
+ <touch file="${output}/asf-logo.gif.lz4"/>
+ <cmp:lz4 src="../resources/asf-logo.gif"
+ destfile="${output}/asf-logo.gif.lz4" />
+ <au:assertLogContains text="Nothing to do: asf-logo.gif.lz4 is up to date."/>
+ </target>
+
+ <target name="testNestedTask" depends="setUp">
+ <cmp:lz4 destfile="${output}/asf-logo.tar.lz4">
+ <cmp:tar>
+ <cmp:cpiofileset src="../resources/asf-logo.gif.bin.cpio"
+ includes="asf-logo.gif"/>
+ </cmp:tar>
+ </cmp:lz4>
+ <au:assertFileExists file="${output}/asf-logo.tar.lz4"/>
+ <au:assertTrue>
+ <cond:islastmodified datetime="2009-07-31-20:11:13 +0200"
+ pattern="yyyy-MM-dd-HH:mm:ss Z">
+ <cmp:tarentry name="asf-logo.gif">
+ <cmp:lz4resource>
+ <file file="${output}/asf-logo.tar.lz4"/>
+ </cmp:lz4resource>
+ </cmp:tarentry>
+ </cond:islastmodified>
+ </au:assertTrue>
+ </target>
+</project>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/src/tests/antunit/lz4resource-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/lz4resource-test.xml b/src/tests/antunit/lz4resource-test.xml
new file mode 100644
index 0000000..d027dab
--- /dev/null
+++ b/src/tests/antunit/lz4resource-test.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project default="antunit"
+ xmlns:au="antlib:org.apache.ant.antunit"
+ xmlns:cond="antlib:org.apache.tools.ant.types.conditions"
+ xmlns:cmp="antlib:org.apache.ant.compress">
+
+ <import file="antunit-base.xml" />
+
+ <target name="setUp">
+ <mkdir dir="${output}"/>
+ </target>
+
+ <target name="testNativeLZ4" depends="setUp">
+ <copy todir="${output}">
+ <cmp:lz4resource>
+ <file file="../resources/asf-logo.gif.lz4"/>
+ </cmp:lz4resource>
+ <globmapper from="*.lz4" to="*"/>
+ </copy>
+ <au:assertFilesMatch expected="../resources/asf-logo.gif"
+ actual="${output}/asf-logo.gif"/>
+ </target>
+
+ <target name="testConcatenatedStreamsDefault"
+ depends="setUp">
+ <echo file="${output}/expected">a</echo>
+ <copy todir="${output}">
+ <cmp:lz4resource>
+ <file file="../resources/multiple.lz4"/>
+ </cmp:lz4resource>
+ <mergemapper to="actual"/>
+ </copy>
+ <au:assertFilesMatch expected="${output}/expected"
+ actual="${output}/actual"/>
+ </target>
+
+ <target name="testConcatenatedStreamsOnlyFirstStream"
+ depends="setUp">
+ <echo file="${output}/expected">a</echo>
+ <copy todir="${output}">
+ <cmp:lz4resource decompressconcatenated="false">
+ <file file="../resources/multiple.lz4"/>
+ </cmp:lz4resource>
+ <mergemapper to="actual"/>
+ </copy>
+ <au:assertFilesMatch expected="${output}/expected"
+ actual="${output}/actual"/>
+ </target>
+
+ <target name="testConcatenatedStreamsAllStreams"
+ depends="setUp">
+ <echo file="${output}/expected">ab</echo>
+ <copy todir="${output}">
+ <cmp:lz4resource decompressconcatenated="true">
+ <file file="../resources/multiple.lz4"/>
+ </cmp:lz4resource>
+ <mergemapper to="actual"/>
+ </copy>
+ <au:assertFilesMatch expected="${output}/expected"
+ actual="${output}/actual"/>
+ </target>
+</project>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/src/tests/antunit/unlz4-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/unlz4-test.xml b/src/tests/antunit/unlz4-test.xml
new file mode 100644
index 0000000..22e8256
--- /dev/null
+++ b/src/tests/antunit/unlz4-test.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project default="antunit"
+ xmlns:au="antlib:org.apache.ant.antunit"
+ xmlns:cond="antlib:org.apache.tools.ant.types.conditions"
+ xmlns:cmp="antlib:org.apache.ant.compress">
+
+ <import file="antunit-base.xml" />
+
+ <target name="setUp">
+ <mkdir dir="${output}"/>
+ </target>
+
+ <target name="test1">
+ <au:expectfailure>
+ <cmp:unlz4/>
+ </au:expectfailure>
+ </target>
+
+ <target name="test2">
+ <au:expectfailure>
+ <cmp:unlz4 src=""/>
+ </au:expectfailure>
+ </target>
+
+ <target name="testLz4Task" depends="setUp">
+ <cmp:lz4 src="../resources/asf-logo.gif"
+ destfile="${output}/asf-logo.gif.lz4"/>
+ <cmp:unlz4 src="${output}/asf-logo.gif.lz4" dest="${output}/asf-logo.gif" />
+ <au:assertFilesMatch expected="../resources/asf-logo.gif"
+ actual="${output}/asf-logo.gif"/>
+ </target>
+
+ <target name="testLz4TaskWithoutFrame" depends="setUp">
+ <cmp:lz4 src="../resources/asf-logo.gif"
+ destfile="${output}/asf-logo.gif.lz4"
+ framed="false"/>
+ <cmp:unlz4 src="${output}/asf-logo.gif.lz4"
+ dest="${output}/asf-logo.gif"
+ framed="false"/>
+ <au:assertFilesMatch expected="../resources/asf-logo.gif"
+ actual="${output}/asf-logo.gif"/>
+ </target>
+
+ <target name="testNativeLz4" depends="setUp">
+ <cmp:unlz4 src="../resources/asf-logo.gif.lz4"
+ dest="${output}/asf-logo.gif" />
+ <au:assertFilesMatch expected="../resources/asf-logo.gif"
+ actual="${output}/asf-logo.gif"/>
+ </target>
+
+ <target name="testWithResource" depends="setUp">
+ <cmp:unlz4 dest="${output}/asf-logo.gif">
+ <file file="../resources/asf-logo.gif.lz4"/>
+ </cmp:unlz4>
+ <au:assertFilesMatch expected="../resources/asf-logo.gif"
+ actual="${output}/asf-logo.gif"/>
+ </target>
+
+ <target name="testConcatenatedStreamsDefault"
+ depends="setUp">
+ <echo file="${output}/expected">a</echo>
+ <cmp:unlz4 dest="${output}/actual">
+ <file file="../resources/multiple.lz4"/>
+ </cmp:unlz4>
+ <au:assertFilesMatch expected="${output}/expected"
+ actual="${output}/actual"/>
+ </target>
+
+ <target name="testConcatenatedStreamsOnlyFirstStream"
+ depends="setUp">
+ <echo file="${output}/expected">a</echo>
+ <cmp:unlz4 dest="${output}/actual" decompressconcatenated="false">
+ <file file="../resources/multiple.lz4"/>
+ </cmp:unlz4>
+ <au:assertFilesMatch expected="${output}/expected"
+ actual="${output}/actual"/>
+ </target>
+
+ <target name="testConcatenatedStreamsAllStreams"
+ depends="setUp">
+ <echo file="${output}/expected">ab</echo>
+ <cmp:unlz4 dest="${output}/actual" decompressconcatenated="true">
+ <file file="../resources/multiple.lz4"/>
+ </cmp:unlz4>
+ <au:assertFilesMatch expected="${output}/expected"
+ actual="${output}/actual"/>
+ </target>
+</project>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/src/tests/resources/asf-logo.gif.lz4
----------------------------------------------------------------------
diff --git a/src/tests/resources/asf-logo.gif.lz4 b/src/tests/resources/asf-logo.gif.lz4
new file mode 100644
index 0000000..cc875dd
Binary files /dev/null and b/src/tests/resources/asf-logo.gif.lz4 differ
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/cfb57edd/src/tests/resources/multiple.lz4
----------------------------------------------------------------------
diff --git a/src/tests/resources/multiple.lz4 b/src/tests/resources/multiple.lz4
new file mode 100644
index 0000000..0814e93
Binary files /dev/null and b/src/tests/resources/multiple.lz4 differ
[11/12] ant-antlibs-compress git commit: somehow i must have
forgotten to to copy 7z content methods
Posted by bo...@apache.org.
somehow i must have forgotten to to copy 7z content methods
Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/67801415
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/67801415
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/67801415
Branch: refs/heads/master
Commit: 678014156d8f4cce747d45c3a9ff97250a9fed5e
Parents: bb057ad
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 21:33:14 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 21:33:14 2017 +0200
----------------------------------------------------------------------
src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/67801415/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java b/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java
index acbc24b..bec62cb 100644
--- a/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java
+++ b/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java
@@ -36,6 +36,7 @@ import java.util.zip.ZipException;
import org.apache.ant.compress.resources.ArFileSet;
import org.apache.ant.compress.resources.CommonsCompressArchiveResource;
import org.apache.ant.compress.resources.CpioFileSet;
+import org.apache.ant.compress.resources.SevenZResource;
import org.apache.ant.compress.resources.TarFileSet;
import org.apache.ant.compress.resources.TarResource;
import org.apache.ant.compress.resources.ZipFileSet;
@@ -610,6 +611,9 @@ public abstract class ArchiveBase extends Task {
ZipResource zr = (ZipResource) r;
return new ResourceFlags(zr.getMode(), zr.getExtraFields(),
zr.getMethod());
+ } else if (r instanceof SevenZResource) {
+ SevenZResource zr = (SevenZResource) r;
+ return new ResourceFlags(zr.getContentMethods());
} else {
CommonsCompressArchiveResource cr =
(CommonsCompressArchiveResource) r;
[04/12] ant-antlibs-compress git commit: can re-enable test when
using Compress 1.14
Posted by bo...@apache.org.
can re-enable test when using Compress 1.14
Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/35e432fc
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/35e432fc
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/35e432fc
Branch: refs/heads/master
Commit: 35e432fcb87427f9912e553038cd8343023b0797
Parents: a46461e
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 10:04:27 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 10:04:27 2017 +0200
----------------------------------------------------------------------
src/tests/antunit/lzma-test.xml | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/35e432fc/src/tests/antunit/lzma-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/lzma-test.xml b/src/tests/antunit/lzma-test.xml
index ce2721c..0811369 100644
--- a/src/tests/antunit/lzma-test.xml
+++ b/src/tests/antunit/lzma-test.xml
@@ -87,9 +87,7 @@
<au:assertLogContains text="Nothing to do: asf-logo.gif.lzma is up to date."/>
</target>
- <!-- re-enable once we upgrade to CC 1.14, see
- https://issues.apache.org/jira/browse/COMPRESS-393 -->
- <target name="XtestNestedTask" depends="setUp">
+ <target name="testNestedTask" depends="setUp">
<cmp:lzma destfile="${output}/asf-logo.tar.lzma">
<cmp:tar>
<cmp:cpiofileset src="../resources/asf-logo.gif.bin.cpio"
[10/12] ant-antlibs-compress git commit: remove redundant public
modifier in interfaces
Posted by bo...@apache.org.
remove redundant public modifier in interfaces
Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/bb057ad2
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/bb057ad2
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/bb057ad2
Branch: refs/heads/master
Commit: bb057ad20dc214974f0c09e8f76c0d39be9ff469
Parents: ae64912
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 19:00:26 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 19:00:26 2017 +0200
----------------------------------------------------------------------
.../org/apache/ant/compress/util/ArchiveStreamFactory.java | 6 ++----
.../org/apache/ant/compress/util/CompressorStreamFactory.java | 6 +++---
.../util/CompressorWithConcatenatedStreamsFactory.java | 6 +++---
3 files changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/bb057ad2/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java b/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java
index 0097dec..5224832 100644
--- a/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java
+++ b/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java
@@ -35,8 +35,7 @@ public interface ArchiveStreamFactory {
* @param encoding the encoding of the entry names, ignored by all
* formats except arj, cpio, dump, tar and zip
*/
- public ArchiveInputStream getArchiveStream(InputStream stream,
- String encoding)
+ ArchiveInputStream getArchiveStream(InputStream stream, String encoding)
throws IOException;
@@ -45,8 +44,7 @@ public interface ArchiveStreamFactory {
* @param encoding the encoding of the entry names, ignored by all
* formats except cpio, tar and zip
*/
- public ArchiveOutputStream getArchiveStream(OutputStream stream,
- String encoding)
+ ArchiveOutputStream getArchiveStream(OutputStream stream, String encoding)
throws IOException;
}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/bb057ad2/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java b/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java
index 4385882..ac2ce3b 100644
--- a/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java
+++ b/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java
@@ -33,14 +33,14 @@ public interface CompressorStreamFactory {
/**
* @param stream the stream to read from, should be buffered
*/
- public CompressorInputStream getCompressorStream(InputStream stream)
+ CompressorInputStream getCompressorStream(InputStream stream)
throws IOException;
/**
* @param stream the stream to write to, should be buffered
*/
- public CompressorOutputStream getCompressorStream(OutputStream stream)
+ CompressorOutputStream getCompressorStream(OutputStream stream)
throws IOException;
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/bb057ad2/src/main/org/apache/ant/compress/util/CompressorWithConcatenatedStreamsFactory.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/util/CompressorWithConcatenatedStreamsFactory.java b/src/main/org/apache/ant/compress/util/CompressorWithConcatenatedStreamsFactory.java
index 409c85a..91e4ea2 100644
--- a/src/main/org/apache/ant/compress/util/CompressorWithConcatenatedStreamsFactory.java
+++ b/src/main/org/apache/ant/compress/util/CompressorWithConcatenatedStreamsFactory.java
@@ -38,7 +38,7 @@ public interface CompressorWithConcatenatedStreamsFactory
* input; if false, stop after the first
* stream
*/
- public CompressorInputStream getCompressorStream(InputStream stream,
- boolean decompressConcatenated)
+ CompressorInputStream getCompressorStream(InputStream stream,
+ boolean decompressConcatenated)
throws IOException;
-}
\ No newline at end of file
+}
[02/12] ant-antlibs-compress git commit: add write support for Snappy
framing format
Posted by bo...@apache.org.
add write support for Snappy framing format
Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/5de99d93
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/5de99d93
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/5de99d93
Branch: refs/heads/master
Commit: 5de99d936182c334f1448330f8b0954a2708052e
Parents: 21789f1
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 06:33:38 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 06:33:38 2017 +0200
----------------------------------------------------------------------
changes.xml | 7 +-
docs/index.html | 1 +
docs/pack.html | 26 +++++
docs/unpack.html | 4 +-
ivy.xml | 2 +-
src/main/org/apache/ant/compress/antlib.xml | 4 +
.../apache/ant/compress/taskdefs/Snappy.java | 55 +++++++++
.../ant/compress/util/SnappyStreamFactory.java | 20 +++-
src/tests/antunit/snappy-test.xml | 111 +++++++++++++++++++
src/tests/antunit/unsnappy-test.xml | 8 ++
10 files changed, 229 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/5de99d93/changes.xml
----------------------------------------------------------------------
diff --git a/changes.xml b/changes.xml
index 0927c18..014c051 100644
--- a/changes.xml
+++ b/changes.xml
@@ -40,8 +40,8 @@
<release version="1.5" date="unreleased">
<action type="update" breaks-bwc="true">
The Apache Compress Antlib now requires Apache Commons
- Compress 1.13 or later for 7z, DEFLATE and write support
- for LZMA.
+ Compress 1.14 or later for 7z, DEFLATE and write support
+ for LZMA and Snappy.
XZ for Java 1.6 is required for write support for LZMA.
</action>
<action type="add">
@@ -63,6 +63,9 @@
<action type="add">
Added support for the DEFLATE format with and without ZLIB headers.
</action>
+ <action type="add">
+ Added write support for the Snappy format.
+ </action>
</release>
<release version="1.4" date="2014-01-29">
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/5de99d93/docs/index.html
----------------------------------------------------------------------
diff --git a/docs/index.html b/docs/index.html
index 5a7b1e3..26f3fb6 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -56,6 +56,7 @@
<li><a href="pack.html#pack200">pack200</a></li>
<li><a href="pack200normalize.html">pack200normalize</a></li>
<li><a href="archive.html#sevenz">sevenz</a></li>
+ <li><a href="pack.html#snappy">snappy</a></li>
<li><a href="archive.html#tar">tar</a></li>
<li><a href="expand.html#un7z">un7z</a></li>
<li><a href="expand.html#unar">unar</a></li>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/5de99d93/docs/pack.html
----------------------------------------------------------------------
diff --git a/docs/pack.html b/docs/pack.html
index 67738e5..0a8700d 100644
--- a/docs/pack.html
+++ b/docs/pack.html
@@ -216,6 +216,32 @@
</tr>
</table>
+ <h3><a name="snappy">Snappy</a></h3>
+
+ <p>Is a <a href="#pack">compressing task</a> that uses
+ the <a href="https://github.com/google/snappy">Snappy</a>
+ compression algorithm.</p>
+
+ <p><em>Since Compress Antlib 1.5</em>
+
+<h4>Parameters</h4>
+ <p>In addition to the attributes supported by all compressing task
+ this task also supports.</p>
+ <table border="1" cellpadding="2" cellspacing="0">
+ <tr>
+ <td valign="top"><b>Attribute</b></td>
+ <td valign="top"><b>Description</b></td>
+ <td align="center" valign="top"><b>Required</b></td>
+ </tr>
+ <tr>
+ <td valign="top">framed</td>
+ <td valign="top">Whether to use
+ the <a href="https://github.com/google/snappy/blob/master/framing_format.txt">framing
+ format</a>.</td>
+ <td align="center" valign="top">No, defaults to true.</td>
+ </tr>
+ </table>
+
<h3><a name="xz">XZ</a></h3>
<p>Is a <a href="#pack">compressing task</a> that uses the XZ
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/5de99d93/docs/unpack.html
----------------------------------------------------------------------
diff --git a/docs/unpack.html b/docs/unpack.html
index 7a7bf7a..2b96a70 100644
--- a/docs/unpack.html
+++ b/docs/unpack.html
@@ -181,7 +181,7 @@ resource collection</h4>
<h3><a name="unsnappy">UnSnappy</a></h3>
<p>Is an <a href="#unpack">uncompressing task</a> that uses
- the <a href="http://code.google.com/p/snappy/">Snappy</a>
+ the <a href="https://github.com/google/snappy">Snappy</a>
compression algorithm.</p>
<p><em>Since Apache Compress Antlib 1.4</em>.</p>
@@ -198,7 +198,7 @@ resource collection</h4>
<tr>
<td valign="top">framed</td>
<td valign="top">Whether the input is expected to use
- the <a href="http://code.google.com/p/snappy/source/browse/trunk/framing_format.txt">framing
+ the <a href="https://github.com/google/snappy/blob/master/framing_format.txt">framing
format</a>.</td>
<td align="center" valign="top">No, defaults to true.</td>
</tr>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/5de99d93/ivy.xml
----------------------------------------------------------------------
diff --git a/ivy.xml b/ivy.xml
index 3d32abb..65bf92b 100644
--- a/ivy.xml
+++ b/ivy.xml
@@ -55,7 +55,7 @@
e:classifier="ivy"/>
</publications>
<dependencies>
- <dependency org="org.apache.commons" name="commons-compress" rev="1.13" conf="default"/>
+ <dependency org="org.apache.commons" name="commons-compress" rev="1.14" conf="default"/>
<dependency org="org.tukaani" name="xz" rev="1.6" conf="default"/>
<dependency org="junit" name="junit" rev="4.11" conf="test->default"/>
</dependencies>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/5de99d93/src/main/org/apache/ant/compress/antlib.xml
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/antlib.xml b/src/main/org/apache/ant/compress/antlib.xml
index 161c64c..8f4ea91 100644
--- a/src/main/org/apache/ant/compress/antlib.xml
+++ b/src/main/org/apache/ant/compress/antlib.xml
@@ -117,6 +117,10 @@
classname="org.apache.ant.compress.taskdefs.SevenZ"
/>
<taskdef
+ name="snappy"
+ classname="org.apache.ant.compress.taskdefs.Snappy"
+ />
+ <taskdef
name="xz"
classname="org.apache.ant.compress.taskdefs.XZ"
/>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/5de99d93/src/main/org/apache/ant/compress/taskdefs/Snappy.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/Snappy.java b/src/main/org/apache/ant/compress/taskdefs/Snappy.java
new file mode 100644
index 0000000..76528e4
--- /dev/null
+++ b/src/main/org/apache/ant/compress/taskdefs/Snappy.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.ant.compress.taskdefs;
+
+import org.apache.ant.compress.resources.SnappyResource;
+import org.apache.ant.compress.resources.CommonsCompressCompressorResource;
+import org.apache.ant.compress.util.SnappyStreamFactory;
+import org.apache.tools.ant.types.Resource;
+
+/**
+ * Compresses using snappy.
+ * @since Apache Compress Antlib 1.5
+ */
+public final class Snappy extends PackBase {
+
+ private final InnerSnappyStreamFactory factory;
+
+ public Snappy() {
+ super(new PackBase.ResourceWrapper() {
+ @Override
+ public CommonsCompressCompressorResource wrap(Resource dest) {
+ return new SnappyResource(dest);
+ }
+ });
+ setFactory(factory = new InnerSnappyStreamFactory());
+ }
+
+ /**
+ * Whether to use the "framing format".
+ *
+ * <p>Defaults to true.</p>
+ */
+ public void setFramed(boolean framed) {
+ factory.setFramed(framed);
+ }
+
+ private class InnerSnappyStreamFactory extends SnappyStreamFactory {
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/5de99d93/src/main/org/apache/ant/compress/util/SnappyStreamFactory.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/util/SnappyStreamFactory.java b/src/main/org/apache/ant/compress/util/SnappyStreamFactory.java
index 3e911bc..5efd4eb 100644
--- a/src/main/org/apache/ant/compress/util/SnappyStreamFactory.java
+++ b/src/main/org/apache/ant/compress/util/SnappyStreamFactory.java
@@ -25,12 +25,13 @@ import java.io.OutputStream;
import org.apache.commons.compress.compressors.CompressorInputStream;
import org.apache.commons.compress.compressors.CompressorOutputStream;
import org.apache.commons.compress.compressors.snappy.FramedSnappyCompressorInputStream;
+import org.apache.commons.compress.compressors.snappy.FramedSnappyCompressorOutputStream;
import org.apache.commons.compress.compressors.snappy.SnappyCompressorInputStream;
/**
* Creates streams for the standalone Snappy format.
- * @since Apache Compress Antlib 1.4
- * @see <a href="http://code.google.com/p/snappy/">Snappy Project</a>
+ * @since Apache Compress Antlib 1.4, write support added with 1.5
+ * @see <a href="https://github.com/google/snappy">Snappy Project</a>
*/
public class SnappyStreamFactory implements CompressorStreamFactory {
@@ -46,6 +47,13 @@ public class SnappyStreamFactory implements CompressorStreamFactory {
}
/**
+ * Whether to use the "framing format".
+ */
+ protected boolean isFramed() {
+ return framed;
+ }
+
+ /**
* @param stream the stream to read from, should be buffered
*/
@Override
@@ -56,11 +64,15 @@ public class SnappyStreamFactory implements CompressorStreamFactory {
}
/**
- * Not implemented.
+ * @param stream the stream to write to, should be buffered
*/
@Override
public CompressorOutputStream getCompressorStream(OutputStream stream)
throws IOException {
- throw new UnsupportedOperationException();
+ if (!framed) {
+ throw new UnsupportedOperationException("Must know the uncompressed size"
+ + " for non-framed snappy");
+ }
+ return new FramedSnappyCompressorOutputStream(stream);
}
}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/5de99d93/src/tests/antunit/snappy-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/snappy-test.xml b/src/tests/antunit/snappy-test.xml
new file mode 100644
index 0000000..34531e7
--- /dev/null
+++ b/src/tests/antunit/snappy-test.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<project default="antunit"
+ xmlns:au="antlib:org.apache.ant.antunit"
+ xmlns:cond="antlib:org.apache.tools.ant.types.conditions"
+ xmlns:cmp="antlib:org.apache.ant.compress">
+
+ <import file="antunit-base.xml" />
+
+ <target name="setUp">
+ <mkdir dir="${output}" />
+ <mkdir dir="${output}/empty" />
+ <touch file="${output}/fileone" />
+ <touch file="${output}/filetwo" />
+ </target>
+
+ <target name="testFailNone" depends="setUp">
+ <au:expectfailure expectedmessage="source is required.">
+ <cmp:snappy destfile="${output}/file.sz">
+ <fileset dir="${output}/empty" />
+ </cmp:snappy>
+ </au:expectfailure>
+ </target>
+
+ <target name="testFailTwo" depends="setUp">
+ <au:expectfailure expectedmessage="Can only have one source.">
+ <cmp:snappy destfile="${output}/file.sz">
+ <fileset dir="${output}" />
+ </cmp:snappy>
+ </au:expectfailure>
+ </target>
+
+ <target name="testFailNoDest" depends="setUp">
+ <au:expectfailure expectedmessage="dest resource is required.">
+ <cmp:snappy src="${output}/fileone">
+ <dest>
+ <fileset dir="${output}/empty" />
+ </dest>
+ </cmp:snappy>
+ </au:expectfailure>
+ </target>
+
+ <target name="testFailTwoDests" depends="setUp">
+ <au:expectfailure expectedmessage="Can only have one destination resource.">
+ <cmp:snappy src="${output}/fileone">
+ <dest>
+ <fileset dir="${output}" />
+ </dest>
+ </cmp:snappy>
+ </au:expectfailure>
+ </target>
+
+ <target name="testRealTest" depends="setUp">
+ <cmp:snappy src="../resources/asf-logo.gif"
+ destfile="${output}/asf-logo.gif.sz" />
+ <au:assertLogContains text="Building: asf-logo.gif.sz"/>
+ <au:assertFileExists file="${output}/asf-logo.gif.sz"/>
+ </target>
+
+ <target name="testRealTestWithResource" depends="setUp">
+ <cmp:snappy destfile="${output}/asf-logo.gif.sz">
+ <file file="../resources/asf-logo.gif"/>
+ </cmp:snappy>
+ <au:assertLogContains text="Building: asf-logo.gif.sz"/>
+ <au:assertFileExists file="${output}/asf-logo.gif.sz"/>
+ </target>
+
+ <target name="testDateCheck" depends="setUp">
+ <touch file="${output}/asf-logo.gif.sz"/>
+ <cmp:snappy src="../resources/asf-logo.gif"
+ destfile="${output}/asf-logo.gif.sz" />
+ <au:assertLogContains text="Nothing to do: asf-logo.gif.sz is up to date."/>
+ </target>
+
+ <!-- re-enable once we upgrade to CC 1.14, see
+ https://issues.apache.org/jira/browse/COMPRESS-393 -->
+ <target name="XtestNestedTask" depends="setUp">
+ <cmp:snappy destfile="${output}/asf-logo.tar.sz">
+ <cmp:tar>
+ <cmp:cpiofileset src="../resources/asf-logo.gif.bin.cpio"
+ includes="asf-logo.gif"/>
+ </cmp:tar>
+ </cmp:snappy>
+ <au:assertFileExists file="${output}/asf-logo.tar.sz"/>
+ <au:assertTrue>
+ <cond:islastmodified datetime="2009-07-31-20:11:13 +0200"
+ pattern="yyyy-MM-dd-HH:mm:ss Z">
+ <cmp:tarentry name="asf-logo.gif">
+ <cmp:snappyresource>
+ <file file="${output}/asf-logo.tar.sz"/>
+ </cmp:snappyresource>
+ </cmp:tarentry>
+ </cond:islastmodified>
+ </au:assertTrue>
+ </target>
+</project>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/5de99d93/src/tests/antunit/unsnappy-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/unsnappy-test.xml b/src/tests/antunit/unsnappy-test.xml
index d8f87db..d8970a8 100644
--- a/src/tests/antunit/unsnappy-test.xml
+++ b/src/tests/antunit/unsnappy-test.xml
@@ -39,6 +39,14 @@
</au:expectfailure>
</target>
+ <target name="testSnappyTask" depends="setUp">
+ <cmp:snappy src="../resources/asf-logo.gif"
+ destfile="${output}/asf-logo.gif.sz"/>
+ <cmp:unsnappy src="${output}/asf-logo.gif.sz" dest="${output}/asf-logo.gif" />
+ <au:assertFilesMatch expected="../resources/asf-logo.gif"
+ actual="${output}/asf-logo.gif"/>
+ </target>
+
<target name="testNativeSnappy" depends="setUp">
<cmp:unsnappy src="../resources/asf-logo.gif.sz"
dest="${output}/asf-logo.gif" />
[08/12] ant-antlibs-compress git commit: more missing @Overrides
Posted by bo...@apache.org.
more missing @Overrides
Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/e838ac0e
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/e838ac0e
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/e838ac0e
Branch: refs/heads/master
Commit: e838ac0e9b6631dc434f62b07c5011bf210ec033
Parents: 0d561ce
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 18:59:54 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 18:59:54 2017 +0200
----------------------------------------------------------------------
.../org/apache/ant/compress/resources/ArFileSet.java | 1 +
.../org/apache/ant/compress/resources/ArjFileSet.java | 1 +
.../apache/ant/compress/resources/CpioFileSet.java | 1 +
.../apache/ant/compress/resources/DumpFileSet.java | 1 +
.../apache/ant/compress/resources/SevenZResource.java | 4 ++++
.../apache/ant/compress/resources/SevenZScanner.java | 1 +
.../org/apache/ant/compress/resources/TarFileSet.java | 1 +
.../apache/ant/compress/resources/ZipResource.java | 2 ++
.../org/apache/ant/compress/resources/ZipScanner.java | 1 +
src/main/org/apache/ant/compress/taskdefs/Ar.java | 5 +++++
.../org/apache/ant/compress/taskdefs/ArchiveBase.java | 1 +
src/main/org/apache/ant/compress/taskdefs/BZip2.java | 3 ++-
src/main/org/apache/ant/compress/taskdefs/Cpio.java | 4 ++++
src/main/org/apache/ant/compress/taskdefs/GZip.java | 2 ++
src/main/org/apache/ant/compress/taskdefs/LZMA.java | 1 +
.../org/apache/ant/compress/taskdefs/Pack200.java | 4 ++++
src/main/org/apache/ant/compress/taskdefs/SevenZ.java | 3 +++
src/main/org/apache/ant/compress/taskdefs/Tar.java | 6 +++++-
src/main/org/apache/ant/compress/taskdefs/Un7z.java | 14 ++++++++------
.../org/apache/ant/compress/taskdefs/UnPack200.java | 2 ++
src/main/org/apache/ant/compress/taskdefs/XZ.java | 3 ++-
src/main/org/apache/ant/compress/taskdefs/Zip.java | 8 +++++++-
22 files changed, 59 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/resources/ArFileSet.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/resources/ArFileSet.java b/src/main/org/apache/ant/compress/resources/ArFileSet.java
index 282d9ce..d78a8fd 100644
--- a/src/main/org/apache/ant/compress/resources/ArFileSet.java
+++ b/src/main/org/apache/ant/compress/resources/ArFileSet.java
@@ -73,6 +73,7 @@ public class ArFileSet extends CommonsCompressFileSet {
protected ArchiveScanner newArchiveScanner() {
return new CommonsCompressArchiveScanner(new ArStreamFactory(),
new CommonsCompressArchiveScanner.ResourceBuilder() {
+ @Override
public Resource buildResource(Resource archive, String encoding,
ArchiveEntry entry) {
return new ArResource(archive, (ArArchiveEntry) entry);
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/resources/ArjFileSet.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/resources/ArjFileSet.java b/src/main/org/apache/ant/compress/resources/ArjFileSet.java
index ee12fe4..78d34c9 100644
--- a/src/main/org/apache/ant/compress/resources/ArjFileSet.java
+++ b/src/main/org/apache/ant/compress/resources/ArjFileSet.java
@@ -75,6 +75,7 @@ public class ArjFileSet extends CommonsCompressFileSet {
CommonsCompressArchiveScanner cs =
new CommonsCompressArchiveScanner(new ArjStreamFactory(),
new CommonsCompressArchiveScanner.ResourceBuilder() {
+ @Override
public Resource buildResource(Resource archive, String encoding,
ArchiveEntry entry) {
return new ArjResource(archive, encoding, (ArjArchiveEntry) entry);
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/resources/CpioFileSet.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/resources/CpioFileSet.java b/src/main/org/apache/ant/compress/resources/CpioFileSet.java
index 49f4c90..b4138d2 100644
--- a/src/main/org/apache/ant/compress/resources/CpioFileSet.java
+++ b/src/main/org/apache/ant/compress/resources/CpioFileSet.java
@@ -74,6 +74,7 @@ public class CpioFileSet extends CommonsCompressFileSet {
CommonsCompressArchiveScanner cs =
new CommonsCompressArchiveScanner(new CpioStreamFactory(),
new CommonsCompressArchiveScanner.ResourceBuilder() {
+ @Override
public Resource buildResource(Resource archive, String encoding,
ArchiveEntry entry) {
return new CpioResource(archive, encoding, (CpioArchiveEntry) entry);
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/resources/DumpFileSet.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/resources/DumpFileSet.java b/src/main/org/apache/ant/compress/resources/DumpFileSet.java
index 134a501..81cbb42 100644
--- a/src/main/org/apache/ant/compress/resources/DumpFileSet.java
+++ b/src/main/org/apache/ant/compress/resources/DumpFileSet.java
@@ -75,6 +75,7 @@ public class DumpFileSet extends CommonsCompressFileSet {
CommonsCompressArchiveScanner cs =
new CommonsCompressArchiveScanner(new DumpStreamFactory(),
new CommonsCompressArchiveScanner.ResourceBuilder() {
+ @Override
public Resource buildResource(Resource archive, String encoding,
ArchiveEntry entry) {
return new DumpResource(archive, encoding, (DumpArchiveEntry) entry);
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/resources/SevenZResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/resources/SevenZResource.java b/src/main/org/apache/ant/compress/resources/SevenZResource.java
index 9a5d25d..379248c 100644
--- a/src/main/org/apache/ant/compress/resources/SevenZResource.java
+++ b/src/main/org/apache/ant/compress/resources/SevenZResource.java
@@ -120,15 +120,19 @@ public final class SevenZResource extends CommonsCompressArchiveResource {
while (ze != null) {
if (ze.getName().equals(getName())) {
return new InputStream() {
+ @Override
public int read() throws IOException {
return z.read();
}
+ @Override
public int read(byte[] b) throws IOException {
return z.read(b);
}
+ @Override
public void close() throws IOException {
z.close();
}
+ @Override
protected void finalize() throws Throwable {
try {
close();
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/resources/SevenZScanner.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/resources/SevenZScanner.java b/src/main/org/apache/ant/compress/resources/SevenZScanner.java
index 8c954ec..3e3c8f4 100644
--- a/src/main/org/apache/ant/compress/resources/SevenZScanner.java
+++ b/src/main/org/apache/ant/compress/resources/SevenZScanner.java
@@ -47,6 +47,7 @@ public class SevenZScanner extends CommonsCompressArchiveScanner {
public SevenZScanner(boolean skipUnreadable, Project project) {
super(new SevenZStreamFactory(),
new CommonsCompressArchiveScanner.ResourceBuilder() {
+ @Override
public Resource buildResource(Resource archive, String encoding,
ArchiveEntry entry) {
return new SevenZResource(archive, encoding,
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/resources/TarFileSet.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/resources/TarFileSet.java b/src/main/org/apache/ant/compress/resources/TarFileSet.java
index a5b2439..d17f09a 100644
--- a/src/main/org/apache/ant/compress/resources/TarFileSet.java
+++ b/src/main/org/apache/ant/compress/resources/TarFileSet.java
@@ -139,6 +139,7 @@ public class TarFileSet extends CommonsCompressFileSet {
CommonsCompressArchiveScanner cs =
new CommonsCompressArchiveScanner(new TarStreamFactory(),
new CommonsCompressArchiveScanner.ResourceBuilder() {
+ @Override
public Resource buildResource(Resource archive, String encoding,
ArchiveEntry entry) {
return new TarResource(archive, encoding,
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/resources/ZipResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/resources/ZipResource.java b/src/main/org/apache/ant/compress/resources/ZipResource.java
index a8ab509..3fca5d4 100644
--- a/src/main/org/apache/ant/compress/resources/ZipResource.java
+++ b/src/main/org/apache/ant/compress/resources/ZipResource.java
@@ -125,10 +125,12 @@ public final class ZipResource extends CommonsCompressArchiveResource {
+ getArchive());
}
return new FilterInputStream(z.getInputStream(ze)) {
+ @Override
public void close() throws IOException {
FileUtils.close(in);
z.close();
}
+ @Override
protected void finalize() throws Throwable {
try {
close();
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/resources/ZipScanner.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/resources/ZipScanner.java b/src/main/org/apache/ant/compress/resources/ZipScanner.java
index d194f36..34fbf03 100644
--- a/src/main/org/apache/ant/compress/resources/ZipScanner.java
+++ b/src/main/org/apache/ant/compress/resources/ZipScanner.java
@@ -47,6 +47,7 @@ public class ZipScanner extends CommonsCompressArchiveScanner {
public ZipScanner(boolean skipUnreadable, Project project) {
super(new ZipStreamFactory(),
new CommonsCompressArchiveScanner.ResourceBuilder() {
+ @Override
public Resource buildResource(Resource archive, String encoding,
ArchiveEntry entry) {
return new ZipResource(archive, encoding,
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/Ar.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/Ar.java b/src/main/org/apache/ant/compress/taskdefs/Ar.java
index dbb57a4..4089062 100644
--- a/src/main/org/apache/ant/compress/taskdefs/Ar.java
+++ b/src/main/org/apache/ant/compress/taskdefs/Ar.java
@@ -43,6 +43,7 @@ public class Ar extends ArchiveBase {
public Ar() {
setFactory(new ArStreamFactory() {
+ @Override
public ArchiveOutputStream getArchiveStream(OutputStream stream,
String encoding)
throws IOException {
@@ -57,6 +58,7 @@ public class Ar extends ArchiveBase {
});
setEntryBuilder(
new ArchiveBase.EntryBuilder() {
+ @Override
public ArchiveEntry buildEntry(ArchiveBase.ResourceWithFlags r) {
boolean isDir = r.getResource().isDirectory();
if (isDir) {
@@ -93,6 +95,7 @@ public class Ar extends ArchiveBase {
}
});
setFileSetBuilder(new ArchiveBase.FileSetBuilder() {
+ @Override
public ArchiveFileSet buildFileSet(Resource dest) {
ArchiveFileSet afs = new ArFileSet();
afs.setSrcResource(dest);
@@ -136,10 +139,12 @@ public class Ar extends ArchiveBase {
setValue(AR_NAME);
}
+ @Override
public String[] getValues() {
return new String[] {AR_NAME, BSD_NAME};
}
+ @Override
public boolean equals(Object other) {
return other instanceof Format
&& ((Format) other).getValue().equals(getValue());
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java b/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java
index 74e34fc..acbc24b 100644
--- a/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java
+++ b/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java
@@ -508,6 +508,7 @@ public abstract class ArchiveBase extends Task {
*/
protected void sort(List/*<ResourceWithFlags>*/ l) {
Collections.sort(l, new Comparator/*<ResourceWithFlags>*/() {
+ @Override
public int compare(Object o1, Object o2) {
ResourceWithFlags r1 = (ResourceWithFlags) o1;
ResourceWithFlags r2 = (ResourceWithFlags) o2;
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/BZip2.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/BZip2.java b/src/main/org/apache/ant/compress/taskdefs/BZip2.java
index a92cb33..4210227 100644
--- a/src/main/org/apache/ant/compress/taskdefs/BZip2.java
+++ b/src/main/org/apache/ant/compress/taskdefs/BZip2.java
@@ -31,10 +31,11 @@ public final class BZip2 extends PackBase {
public BZip2() {
super(new BZip2StreamFactory(),
new PackBase.ResourceWrapper() {
+ @Override
public CommonsCompressCompressorResource wrap(Resource dest) {
return new BZip2Resource(dest);
}
});
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/Cpio.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/Cpio.java b/src/main/org/apache/ant/compress/taskdefs/Cpio.java
index 0706ea8..2c5e1a9 100644
--- a/src/main/org/apache/ant/compress/taskdefs/Cpio.java
+++ b/src/main/org/apache/ant/compress/taskdefs/Cpio.java
@@ -41,6 +41,7 @@ public class Cpio extends ArchiveBase {
public Cpio() {
setFactory(new CpioStreamFactory() {
+ @Override
public ArchiveOutputStream getArchiveStream(OutputStream stream,
String encoding)
throws IOException {
@@ -52,6 +53,7 @@ public class Cpio extends ArchiveBase {
});
setEntryBuilder(
new ArchiveBase.EntryBuilder() {
+ @Override
public ArchiveEntry buildEntry(ArchiveBase.ResourceWithFlags r) {
boolean isDir = r.getResource().isDirectory();
CpioArchiveEntry ent =
@@ -91,6 +93,7 @@ public class Cpio extends ArchiveBase {
}
});
setFileSetBuilder(new ArchiveBase.FileSetBuilder() {
+ @Override
public ArchiveFileSet buildFileSet(Resource dest) {
ArchiveFileSet afs = new CpioFileSet();
afs.setSrcResource(dest);
@@ -142,6 +145,7 @@ public class Cpio extends ArchiveBase {
setValue(BINARY_NAME);
}
+ @Override
public String[] getValues() {
return new String[] {
BINARY_NAME, OLD_ASCII_NAME, ODC_NAME, NEW_ASCII_NAME, //CRC_NAME
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/GZip.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/GZip.java b/src/main/org/apache/ant/compress/taskdefs/GZip.java
index 97b9b00..ba7709d 100644
--- a/src/main/org/apache/ant/compress/taskdefs/GZip.java
+++ b/src/main/org/apache/ant/compress/taskdefs/GZip.java
@@ -38,11 +38,13 @@ public final class GZip extends PackBase {
public GZip() {
super(new PackBase.ResourceWrapper() {
+ @Override
public CommonsCompressCompressorResource wrap(Resource dest) {
return new GZipResource(dest);
}
});
setFactory(new GZipStreamFactory() {
+ @Override
public CompressorOutputStream getCompressorStream(OutputStream stream)
throws IOException {
GzipParameters params = new GzipParameters();
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/LZMA.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/LZMA.java b/src/main/org/apache/ant/compress/taskdefs/LZMA.java
index ca98412..d25b1c7 100644
--- a/src/main/org/apache/ant/compress/taskdefs/LZMA.java
+++ b/src/main/org/apache/ant/compress/taskdefs/LZMA.java
@@ -32,6 +32,7 @@ public final class LZMA extends PackBase {
public LZMA() {
super(new LZMAStreamFactory(),
new PackBase.ResourceWrapper() {
+ @Override
public CommonsCompressCompressorResource wrap(Resource dest) {
return new LZMAResource(dest);
}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/Pack200.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/Pack200.java b/src/main/org/apache/ant/compress/taskdefs/Pack200.java
index 83e30d3..1908377 100644
--- a/src/main/org/apache/ant/compress/taskdefs/Pack200.java
+++ b/src/main/org/apache/ant/compress/taskdefs/Pack200.java
@@ -46,11 +46,13 @@ public final class Pack200 extends PackBase {
public Pack200() {
super(new PackBase.ResourceWrapper() {
+ @Override
public CommonsCompressCompressorResource wrap(Resource dest) {
return new Pack200Resource(dest);
}
});
setFactory(new CompressorStreamFactory() {
+ @Override
public CompressorOutputStream
getCompressorStream(OutputStream stream)
throws IOException {
@@ -59,6 +61,7 @@ public final class Pack200 extends PackBase {
.getStrategy(),
properties);
}
+ @Override
public CompressorInputStream
getCompressorStream(InputStream stream)
throws IOException {
@@ -97,6 +100,7 @@ public final class Pack200 extends PackBase {
STRATEGIES.put(TEMP_FILE_KEY, Pack200Strategy.TEMP_FILE);
}
+ @Override
public String[] getValues() {
return new String[] {IN_MEMORY_KEY, TEMP_FILE_KEY};
}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/SevenZ.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/SevenZ.java b/src/main/org/apache/ant/compress/taskdefs/SevenZ.java
index 99b72de..e4bee13 100644
--- a/src/main/org/apache/ant/compress/taskdefs/SevenZ.java
+++ b/src/main/org/apache/ant/compress/taskdefs/SevenZ.java
@@ -48,6 +48,7 @@ public class SevenZ extends ArchiveBase {
public SevenZ() {
setFactory(new SevenZStreamFactory() {
+ @Override
public ArchiveOutputStream getArchiveOutputStream(File f,
String encoding)
throws IOException {
@@ -64,6 +65,7 @@ public class SevenZ extends ArchiveBase {
});
setEntryBuilder(
new ArchiveBase.EntryBuilder() {
+ @Override
public ArchiveEntry buildEntry(ArchiveBase.ResourceWithFlags r) {
SevenZArchiveEntry entry = new SevenZArchiveEntry();
entry.setName(r.getName());
@@ -80,6 +82,7 @@ public class SevenZ extends ArchiveBase {
}
});
setFileSetBuilder(new ArchiveBase.FileSetBuilder() {
+ @Override
public ArchiveFileSet buildFileSet(Resource dest) {
ArchiveFileSet afs = new SevenZFileSet();
afs.setSrcResource(dest);
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/Tar.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/Tar.java b/src/main/org/apache/ant/compress/taskdefs/Tar.java
index 4e59d02..b01a512 100644
--- a/src/main/org/apache/ant/compress/taskdefs/Tar.java
+++ b/src/main/org/apache/ant/compress/taskdefs/Tar.java
@@ -39,6 +39,7 @@ public class Tar extends ArchiveBase {
public Tar() {
setFactory(new TarStreamFactory(){
+ @Override
public ArchiveOutputStream getArchiveStream(OutputStream stream,
String encoding)
throws IOException {
@@ -69,6 +70,7 @@ public class Tar extends ArchiveBase {
});
setEntryBuilder(
new ArchiveBase.EntryBuilder() {
+ @Override
public ArchiveEntry buildEntry(ArchiveBase.ResourceWithFlags r) {
boolean isDir = r.getResource().isDirectory();
String name = r.getName();
@@ -124,6 +126,7 @@ public class Tar extends ArchiveBase {
}
});
setFileSetBuilder(new ArchiveBase.FileSetBuilder() {
+ @Override
public ArchiveFileSet buildFileSet(Resource dest) {
ArchiveFileSet afs = new TarFileSet();
afs.setSrcResource(dest);
@@ -163,6 +166,7 @@ public class Tar extends ArchiveBase {
setValue(USTAR_NAME);
}
+ @Override
public String[] getValues() {
return new String[] {
USTAR_NAME, OLDGNU_NAME, GNU_NAME,
@@ -175,4 +179,4 @@ public class Tar extends ArchiveBase {
&& ((Format) other).getValue().equals(getValue());
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/Un7z.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/Un7z.java b/src/main/org/apache/ant/compress/taskdefs/Un7z.java
index 8adfb06..3fa4e74 100644
--- a/src/main/org/apache/ant/compress/taskdefs/Un7z.java
+++ b/src/main/org/apache/ant/compress/taskdefs/Un7z.java
@@ -68,12 +68,14 @@ public class Un7z extends ExpandBase {
*/
log("extracting " + ze.getName(), Project.MSG_DEBUG);
try (InputStream is = new InputStream() {
- public int read() throws IOException {
- return zf.read();
- }
- public int read(byte[] b) throws IOException {
- return zf.read(b);
- }
+ @Override
+ public int read() throws IOException {
+ return zf.read();
+ }
+ @Override
+ public int read(byte[] b) throws IOException {
+ return zf.read(b);
+ }
}) {
extractFile(fileUtils, srcF, dir, is,
ze.getName(), ze.getLastModifiedDate(),
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/UnPack200.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/UnPack200.java b/src/main/org/apache/ant/compress/taskdefs/UnPack200.java
index 0877f1d..8342928 100644
--- a/src/main/org/apache/ant/compress/taskdefs/UnPack200.java
+++ b/src/main/org/apache/ant/compress/taskdefs/UnPack200.java
@@ -42,6 +42,7 @@ public final class UnPack200 extends UnpackBase {
public UnPack200() {
super(".pack");
setFactory(new Pack200StreamFactory() {
+ @Override
public CompressorInputStream
getCompressorStream(InputStream stream)
throws IOException {
@@ -50,6 +51,7 @@ public final class UnPack200 extends UnpackBase {
.getStrategy(),
properties);
}
+ @Override
public CompressorInputStream getCompressorInputStream(File file)
throws IOException {
return new Pack200CompressorInputStream(file,
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/XZ.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/XZ.java b/src/main/org/apache/ant/compress/taskdefs/XZ.java
index d9f50a8..2a6b5ac 100644
--- a/src/main/org/apache/ant/compress/taskdefs/XZ.java
+++ b/src/main/org/apache/ant/compress/taskdefs/XZ.java
@@ -32,10 +32,11 @@ public final class XZ extends PackBase {
public XZ() {
super(new XZStreamFactory(),
new PackBase.ResourceWrapper() {
+ @Override
public CommonsCompressCompressorResource wrap(Resource dest) {
return new XZResource(dest);
}
});
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/e838ac0e/src/main/org/apache/ant/compress/taskdefs/Zip.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/Zip.java b/src/main/org/apache/ant/compress/taskdefs/Zip.java
index 2fb22cd..7a1880f 100644
--- a/src/main/org/apache/ant/compress/taskdefs/Zip.java
+++ b/src/main/org/apache/ant/compress/taskdefs/Zip.java
@@ -50,6 +50,7 @@ public class Zip extends ArchiveBase {
public Zip() {
setFactory(new ZipStreamFactory() {
+ @Override
public ArchiveOutputStream getArchiveStream(OutputStream stream,
String encoding)
throws IOException {
@@ -59,6 +60,7 @@ public class Zip extends ArchiveBase {
configure(o);
return o;
}
+ @Override
public ArchiveOutputStream getArchiveOutputStream(File f,
String encoding)
throws IOException {
@@ -70,6 +72,7 @@ public class Zip extends ArchiveBase {
});
setEntryBuilder(
new ArchiveBase.EntryBuilder() {
+ @Override
public ArchiveEntry buildEntry(ArchiveBase.ResourceWithFlags r) {
boolean isDir = r.getResource().isDirectory();
ZipArchiveEntry ent = new ZipArchiveEntry(r.getName());
@@ -104,6 +107,7 @@ public class Zip extends ArchiveBase {
}
});
setFileSetBuilder(new ArchiveBase.FileSetBuilder() {
+ @Override
public ArchiveFileSet buildFileSet(Resource dest) {
ArchiveFileSet afs = new ZipFileSet();
afs.setSrcResource(dest);
@@ -201,6 +205,7 @@ public class Zip extends ArchiveBase {
.NOT_ENCODEABLE);
}
+ @Override
public String[] getValues() {
return new String[] {NEVER_KEY, ALWAYS_KEY, N_E_KEY};
}
@@ -237,6 +242,7 @@ public class Zip extends ArchiveBase {
POLICIES.put(A_N_KEY, Zip64Mode.AsNeeded);
}
+ @Override
public String[] getValues() {
return new String[] {NEVER_KEY, ALWAYS_KEY, A_N_KEY};
}
@@ -254,4 +260,4 @@ public class Zip extends ArchiveBase {
return (Zip64Mode) POLICIES.get(getValue());
}
}
-}
\ No newline at end of file
+}
[03/12] ant-antlibs-compress git commit: add support for writing
Snappy without framing
Posted by bo...@apache.org.
add support for writing Snappy without framing
Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/a46461e4
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/a46461e4
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/a46461e4
Branch: refs/heads/master
Commit: a46461e43f153af101caf3a8ac43edb3d9c2cb55
Parents: 5de99d9
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 10:02:54 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 10:02:54 2017 +0200
----------------------------------------------------------------------
docs/pack.html | 7 +++++--
.../org/apache/ant/compress/taskdefs/PackBase.java | 7 +++++++
src/main/org/apache/ant/compress/taskdefs/Snappy.java | 13 +++++++++++++
src/tests/antunit/unsnappy-test.xml | 11 +++++++++++
4 files changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/a46461e4/docs/pack.html
----------------------------------------------------------------------
diff --git a/docs/pack.html b/docs/pack.html
index 0a8700d..39e9b10 100644
--- a/docs/pack.html
+++ b/docs/pack.html
@@ -236,8 +236,11 @@
<tr>
<td valign="top">framed</td>
<td valign="top">Whether to use
- the <a href="https://github.com/google/snappy/blob/master/framing_format.txt">framing
- format</a>.</td>
+ the <a href="https://github.com/google/snappy/blob/master/framing_format.txt">framing
+ format</a>.<br/> When setting this to false only resources of
+ known (uncompressed) size can be compressed (for example
+ files).
+ </td>
<td align="center" valign="top">No, defaults to true.</td>
</tr>
</table>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/a46461e4/src/main/org/apache/ant/compress/taskdefs/PackBase.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/PackBase.java b/src/main/org/apache/ant/compress/taskdefs/PackBase.java
index 9c5d6de..4f63b91 100644
--- a/src/main/org/apache/ant/compress/taskdefs/PackBase.java
+++ b/src/main/org/apache/ant/compress/taskdefs/PackBase.java
@@ -232,6 +232,13 @@ public abstract class PackBase extends Task {
}
}
+ /**
+ * @since Apache Compress Antlib 1.5
+ */
+ protected final Resource getSrc() {
+ return src;
+ }
+
public static interface ResourceWrapper {
CommonsCompressCompressorResource wrap(Resource dest);
}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/a46461e4/src/main/org/apache/ant/compress/taskdefs/Snappy.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/Snappy.java b/src/main/org/apache/ant/compress/taskdefs/Snappy.java
index 76528e4..f41e2e8 100644
--- a/src/main/org/apache/ant/compress/taskdefs/Snappy.java
+++ b/src/main/org/apache/ant/compress/taskdefs/Snappy.java
@@ -18,9 +18,14 @@
package org.apache.ant.compress.taskdefs;
+import java.io.IOException;
+import java.io.OutputStream;
+
import org.apache.ant.compress.resources.SnappyResource;
import org.apache.ant.compress.resources.CommonsCompressCompressorResource;
import org.apache.ant.compress.util.SnappyStreamFactory;
+import org.apache.commons.compress.compressors.CompressorOutputStream;
+import org.apache.commons.compress.compressors.snappy.SnappyCompressorOutputStream;
import org.apache.tools.ant.types.Resource;
/**
@@ -51,5 +56,13 @@ public final class Snappy extends PackBase {
}
private class InnerSnappyStreamFactory extends SnappyStreamFactory {
+ @Override
+ public CompressorOutputStream getCompressorStream(OutputStream stream)
+ throws IOException {
+ if (isFramed() || getSrc() == null || getSrc().getSize() < 0) {
+ return super.getCompressorStream(stream);
+ }
+ return new SnappyCompressorOutputStream(stream, getSrc().getSize());
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/a46461e4/src/tests/antunit/unsnappy-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/unsnappy-test.xml b/src/tests/antunit/unsnappy-test.xml
index d8970a8..c8b0ff0 100644
--- a/src/tests/antunit/unsnappy-test.xml
+++ b/src/tests/antunit/unsnappy-test.xml
@@ -47,6 +47,17 @@
actual="${output}/asf-logo.gif"/>
</target>
+ <target name="testSnappyTaskWithoutFraming" depends="setUp">
+ <cmp:snappy src="../resources/asf-logo.gif"
+ destfile="${output}/asf-logo.gif.sz"
+ framed="false"/>
+ <cmp:unsnappy src="${output}/asf-logo.gif.sz"
+ dest="${output}/asf-logo.gif"
+ framed="false"/>
+ <au:assertFilesMatch expected="../resources/asf-logo.gif"
+ actual="${output}/asf-logo.gif"/>
+ </target>
+
<target name="testNativeSnappy" depends="setUp">
<cmp:unsnappy src="../resources/asf-logo.gif.sz"
dest="${output}/asf-logo.gif" />
[05/12] ant-antlibs-compress git commit: some more writable snappy
tweaks
Posted by bo...@apache.org.
some more writable snappy tweaks
Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/fefec90e
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/fefec90e
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/fefec90e
Branch: refs/heads/master
Commit: fefec90e2e346faf907321c98806099bb58619d1
Parents: 35e432f
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 10:55:10 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 10:55:10 2017 +0200
----------------------------------------------------------------------
docs/index.html | 2 +-
src/tests/antunit/snappy-test.xml | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/fefec90e/docs/index.html
----------------------------------------------------------------------
diff --git a/docs/index.html b/docs/index.html
index 26f3fb6..f7e2c4b 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -31,7 +31,7 @@
Commons Compress</a>. Using Apache Commons Compress 1.13 this
Antlib supports gzip, bzip2, lzma standalone, xz, .Z, DEFLATE, Snappy and
pack200 compression and ar, arj, cpio, 7z, Unix dump, tar and
- zip archives. Support for arj, .Z, Snappy and dump is
+ zip archives. Support for arj, .Z and dump is
read-only. 7z can only be used on filesystem resources.</p>
<h3>Known Limitations</h3>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/fefec90e/src/tests/antunit/snappy-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/snappy-test.xml b/src/tests/antunit/snappy-test.xml
index 34531e7..2751b44 100644
--- a/src/tests/antunit/snappy-test.xml
+++ b/src/tests/antunit/snappy-test.xml
@@ -87,9 +87,7 @@
<au:assertLogContains text="Nothing to do: asf-logo.gif.sz is up to date."/>
</target>
- <!-- re-enable once we upgrade to CC 1.14, see
- https://issues.apache.org/jira/browse/COMPRESS-393 -->
- <target name="XtestNestedTask" depends="setUp">
+ <target name="testNestedTask" depends="setUp">
<cmp:snappy destfile="${output}/asf-logo.tar.sz">
<cmp:tar>
<cmp:cpiofileset src="../resources/asf-logo.gif.bin.cpio"
[09/12] ant-antlibs-compress git commit: fix error message
Posted by bo...@apache.org.
fix error message
Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/ae649123
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/ae649123
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/ae649123
Branch: refs/heads/master
Commit: ae64912383609454e67a90c950b4f2a045091e38
Parents: e838ac0
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 19:00:11 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 19:00:11 2017 +0200
----------------------------------------------------------------------
src/main/org/apache/ant/compress/taskdefs/ExpandBase.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/ae649123/src/main/org/apache/ant/compress/taskdefs/ExpandBase.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/ExpandBase.java b/src/main/org/apache/ant/compress/taskdefs/ExpandBase.java
index d75de09..cb57760 100644
--- a/src/main/org/apache/ant/compress/taskdefs/ExpandBase.java
+++ b/src/main/org/apache/ant/compress/taskdefs/ExpandBase.java
@@ -75,7 +75,7 @@ public abstract class ExpandBase extends Expand {
*/
public void setScanForUnicodeExtraFields(boolean b) {
throw new BuildException("The " + getTaskName()
- + " task doesn't support the encoding"
+ + " task doesn't support the scanForUnicodeExtraFields"
+ " attribute", getLocation());
}
[07/12] ant-antlibs-compress git commit: add read-only Brotli support
Posted by bo...@apache.org.
add read-only Brotli support
Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/0d561ceb
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/0d561ceb
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/0d561ceb
Branch: refs/heads/master
Commit: 0d561cebab37b6f0f6662f1154d616e9313c1347
Parents: cfb57ed
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 8 18:58:25 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 8 18:58:25 2017 +0200
----------------------------------------------------------------------
changes.xml | 6 +-
docs/compresource.html | 22 +++++++
docs/index.html | 18 ++++--
docs/unpack.html | 7 +++
ivy.xml | 4 +-
src/main/org/apache/ant/compress/antlib.xml | 8 +++
.../ant/compress/resources/BrotliResource.java | 37 ++++++++++++
.../apache/ant/compress/taskdefs/UnBrotli.java | 33 +++++++++++
.../ant/compress/util/BrotliStreamFactory.java | 52 +++++++++++++++++
src/tests/antunit/brotliresource-test.xml | 41 +++++++++++++
src/tests/antunit/unbrotli-test.xml | 58 +++++++++++++++++++
src/tests/resources/asf-logo.gif.br | Bin 0 -> 6944 bytes
12 files changed, 279 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/0d561ceb/changes.xml
----------------------------------------------------------------------
diff --git a/changes.xml b/changes.xml
index 085cbcd..6d34883 100644
--- a/changes.xml
+++ b/changes.xml
@@ -42,7 +42,8 @@
The Apache Compress Antlib now requires Apache Commons
Compress 1.14 or later for 7z, DEFLATE, LZ4 and write support
for LZMA and Snappy.
- XZ for Java 1.6 is required for write support for LZMA.
+ XZ for Java 1.6 or later is required for write support for LZMA.
+ Brotli dec 0.1.2 or later is required for Brotli support.
</action>
<action type="add">
A new keepCompression flag can be used to keep the content
@@ -69,6 +70,9 @@
<action type="add">
Added support for the LZ4 format.
</action>
+ <action type="add">
+ Added read-only support for the Brotli format.
+ </action>
</release>
<release version="1.4" date="2014-01-29">
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/0d561ceb/docs/compresource.html
----------------------------------------------------------------------
diff --git a/docs/compresource.html b/docs/compresource.html
index 3091c72..714fece 100644
--- a/docs/compresource.html
+++ b/docs/compresource.html
@@ -39,6 +39,28 @@
value false only the first stream is uncompressed.</p>
</a>
+<h2><a name="brotliresource">brotliresource</a></h2>
+
+<p>This is a <a href="#compresource">compressed resource</a> using the
+ Brotli compression.</p>
+
+ <p><em>Since Compress Antlib 1.5</em>
+
+<h4>Examples</h4>
+
+<pre>
+<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>
+</pre>
+
+<p>Represents the entry named some-file.txt in archive
+ some-archive.tar.br where the <code>brotliresource</code> provides
+ the decompression of the archive.</p>
+
<h2><a name="bzip2resource">bzip2resource</a></h2>
<p>This is a <a href="#compresource">compressed resource</a> using the
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/0d561ceb/docs/index.html
----------------------------------------------------------------------
diff --git a/docs/index.html b/docs/index.html
index c249f43..b16a16a 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -30,9 +30,10 @@
based on <a href="http://commons.apache.org/compress/">Apache
Commons Compress</a>. Using Apache Commons Compress 1.14 this
Antlib supports gzip, bzip2, lzma standalone, xz, .Z, DEFLATE,
- Snappy, LZ4 and pack200 compression and ar, arj, cpio, 7z, Unix
- dump, tar and zip archives. Support for arj, .Z and dump is
- read-only. 7z can only be used on filesystem resources.</p>
+ Snappy, LZ4, Brotli and pack200 compression and ar, arj, cpio,
+ 7z, Unix dump, tar and zip archives. Support for arj, .Z,
+ Brotli and dump is read-only. 7z can only be used on filesystem
+ resources.</p>
<h3>Known Limitations</h3>
@@ -62,6 +63,7 @@
<li><a href="expand.html#un7z">un7z</a></li>
<li><a href="expand.html#unar">unar</a></li>
<li><a href="expand.html#unarj">unarj</a></li>
+ <li><a href="unpack.html#unbrotli">unbrotli</a></li>
<li><a href="expand.html#uncpio">uncpio</a></li>
<li><a href="unpack.html#undeflate">undeflate</a></li>
<li><a href="expand.html#undump">undump</a></li>
@@ -85,6 +87,7 @@
<li><a href="entry.html#arjentry">arjentry</a></li>
<li><a href="fileset.html#arfileset">arfileset</a></li>
<li><a href="fileset.html#arjfileset">arjfileset</a></li>
+ <li><a href="compresource.html#brotliresource">brotliresource</a></li>
<li><a href="compresource.html#bzip2resource">bzip2resource</a></li>
<li><a href="entry.html#cpioentry">cpioentry</a></li>
<li><a href="fileset.html#cpiofileset">cpiofileset</a></li>
@@ -121,11 +124,15 @@
<h3>Installing and Using</h3>
<p>This Antlib requires Apache Ant 1.8.0 or higher, Apache
- Commons Compress 1.13 or higher and Java7 or higher.</p>
+ Commons Compress 1.14 or higher and Java7 or higher.</p>
<p>In order to use LZMA, XZ or most of the 7z support
the <a href="https://tukaani.org/xz/java.html">XZ for Java</a>
- version 1.6 or later is required.
+ version 1.6 or later is required.</p>
+
+ <p>In order to use Brotli
+ the <a href="https://github.com/google/brotli">Brotli dec</a>
+ library verision 0.1.2 or later is required.</p>
<p>If you are building the Antlib from sources, run
the <code>antlib</code> target and you'll get a
@@ -155,6 +162,7 @@
<pathelement location="YOUR-PATH-TO/commons-compress-VERSION2.jar"/>
<!-- optional dependencies -->
<pathelement location="YOUR-PATH-TO/xz-VERSION3.jar"/>
+ <pathelement location="YOUR-PATH-TO/dec-VERSION4.jar"/>
</classpath>
</taskdef>
</pre>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/0d561ceb/docs/unpack.html
----------------------------------------------------------------------
diff --git a/docs/unpack.html b/docs/unpack.html
index e36d97d..c47eae0 100644
--- a/docs/unpack.html
+++ b/docs/unpack.html
@@ -93,6 +93,13 @@ resource collection</h4>
the <a href="#decompressConcatenated">decompressConcatenated</a>
attribute.</p>
+<h3><a name="unbrotli">unbrotli</a></h3>
+
+<p>Is an <a href="#unpack">uncompressing task</a> that uses the Brotli
+ compression algorithm.</p>
+
+ <p><em>Since Compress Antlib 1.5</em>
+
<h3><a name="undeflate">Undeflate</a></h3>
<p>Is an <a href="#unpack">uncompressing task</a> that uses the DEFLATE
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/0d561ceb/ivy.xml
----------------------------------------------------------------------
diff --git a/ivy.xml b/ivy.xml
index 4eadc03..eb034ac 100644
--- a/ivy.xml
+++ b/ivy.xml
@@ -29,7 +29,8 @@
<description homepage="http://ant.apache.org/antlibs/compress/">
Provides tasks and types that deal with AR, ARJ, CPIO, TAR,
DUMP, 7Z and ZIP archives as well as BZIP2, PACK200, GZIP, LZMA,
- Snappy, LZ4 and XZ compressed files based on Apache Commons Compress.
+ Snappy, LZ4, Brotli and XZ compressed files based on Apache
+ Commons Compress.
</description>
</info>
<configurations>
@@ -57,6 +58,7 @@
<dependencies>
<dependency org="org.apache.commons" name="commons-compress" rev="1.14" conf="default"/>
<dependency org="org.tukaani" name="xz" rev="1.6" conf="default"/>
+ <dependency org="org.brotli" name="dec" rev="0.1.2" conf="default"/>
<dependency org="junit" name="junit" rev="4.11" conf="test->default"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/0d561ceb/src/main/org/apache/ant/compress/antlib.xml
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/antlib.xml b/src/main/org/apache/ant/compress/antlib.xml
index 00b762a..e4c8354 100644
--- a/src/main/org/apache/ant/compress/antlib.xml
+++ b/src/main/org/apache/ant/compress/antlib.xml
@@ -29,6 +29,10 @@
classname="org.apache.ant.compress.taskdefs.Unarj"
/>
<taskdef
+ name="unbrotli"
+ classname="org.apache.ant.compress.taskdefs.UnBrotli"
+ />
+ <taskdef
name="uncpio"
classname="org.apache.ant.compress.taskdefs.Uncpio"
/>
@@ -199,6 +203,10 @@
classname="org.apache.ant.compress.resources.Archives"
/>
<typedef
+ name="brotliresource"
+ classname="org.apache.ant.compress.resources.BrotliResource"
+ />
+ <typedef
name="bzip2resource"
classname="org.apache.ant.compress.resources.BZip2Resource"
/>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/0d561ceb/src/main/org/apache/ant/compress/resources/BrotliResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/resources/BrotliResource.java b/src/main/org/apache/ant/compress/resources/BrotliResource.java
new file mode 100644
index 0000000..6f35417
--- /dev/null
+++ b/src/main/org/apache/ant/compress/resources/BrotliResource.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ant.compress.resources;
+
+import org.apache.ant.compress.util.BrotliStreamFactory;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/**
+ * A Brotli compressed resource.
+ * @since Apache Compress Antlib 1.5
+ */
+public final class BrotliResource extends CommonsCompressCompressorResource {
+ private static final String NAME = "Brotli";
+
+ public BrotliResource() {
+ super(NAME, new BrotliStreamFactory());
+ }
+
+ public BrotliResource(ResourceCollection other) {
+ super(NAME, new BrotliStreamFactory(), other);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/0d561ceb/src/main/org/apache/ant/compress/taskdefs/UnBrotli.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/taskdefs/UnBrotli.java b/src/main/org/apache/ant/compress/taskdefs/UnBrotli.java
new file mode 100644
index 0000000..d1ae5a5
--- /dev/null
+++ b/src/main/org/apache/ant/compress/taskdefs/UnBrotli.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.ant.compress.taskdefs;
+
+import org.apache.ant.compress.util.BrotliStreamFactory;
+
+/**
+ * Expands a Brotli compressed resource.
+ * @since Apache Compress Antlib 1.5
+ */
+public final class UnBrotli extends UnpackBase {
+
+ public UnBrotli() {
+ super(".br", new BrotliStreamFactory());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/0d561ceb/src/main/org/apache/ant/compress/util/BrotliStreamFactory.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/util/BrotliStreamFactory.java b/src/main/org/apache/ant/compress/util/BrotliStreamFactory.java
new file mode 100644
index 0000000..eb19c84
--- /dev/null
+++ b/src/main/org/apache/ant/compress/util/BrotliStreamFactory.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.ant.compress.util;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.commons.compress.compressors.CompressorInputStream;
+import org.apache.commons.compress.compressors.CompressorOutputStream;
+import org.apache.commons.compress.compressors.brotli.BrotliCompressorInputStream;
+
+/**
+ * Creates streams for the Brotli compression format.
+ * @since Apache Compress Antlib 1.5
+ */
+public class BrotliStreamFactory implements CompressorStreamFactory {
+
+ /**
+ * @param stream the stream to read from, should be buffered
+ */
+ @Override
+ public CompressorInputStream getCompressorStream(InputStream stream)
+ throws IOException {
+ return new BrotliCompressorInputStream(stream);
+ }
+
+ /**
+ * Not implemented.
+ */
+ @Override
+ public CompressorOutputStream getCompressorStream(OutputStream stream)
+ throws IOException {
+ throw new UnsupportedOperationException();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/0d561ceb/src/tests/antunit/brotliresource-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/brotliresource-test.xml b/src/tests/antunit/brotliresource-test.xml
new file mode 100644
index 0000000..bdd5757
--- /dev/null
+++ b/src/tests/antunit/brotliresource-test.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project default="antunit"
+ xmlns:au="antlib:org.apache.ant.antunit"
+ xmlns:cond="antlib:org.apache.tools.ant.types.conditions"
+ xmlns:cmp="antlib:org.apache.ant.compress">
+
+ <import file="antunit-base.xml" />
+
+ <target name="setUp">
+ <mkdir dir="${output}"/>
+ </target>
+
+ <target name="testNativeBrotli" depends="setUp">
+ <copy todir="${output}">
+ <cmp:brotliresource>
+ <file file="../resources/asf-logo.gif.br"/>
+ </cmp:brotliresource>
+ <globmapper from="*.br" to="*"/>
+ </copy>
+ <au:assertFilesMatch expected="../resources/asf-logo.gif"
+ actual="${output}/asf-logo.gif"/>
+ </target>
+
+</project>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/0d561ceb/src/tests/antunit/unbrotli-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/unbrotli-test.xml b/src/tests/antunit/unbrotli-test.xml
new file mode 100644
index 0000000..9058969
--- /dev/null
+++ b/src/tests/antunit/unbrotli-test.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project default="antunit"
+ xmlns:au="antlib:org.apache.ant.antunit"
+ xmlns:cond="antlib:org.apache.tools.ant.types.conditions"
+ xmlns:cmp="antlib:org.apache.ant.compress">
+
+ <import file="antunit-base.xml" />
+
+ <target name="setUp">
+ <mkdir dir="${output}"/>
+ </target>
+
+ <target name="test1">
+ <au:expectfailure>
+ <cmp:unbrotli/>
+ </au:expectfailure>
+ </target>
+
+ <target name="test2">
+ <au:expectfailure>
+ <cmp:unbrotli src=""/>
+ </au:expectfailure>
+ </target>
+
+ <target name="testNativeBrotli" depends="setUp">
+ <cmp:unbrotli src="../resources/asf-logo.gif.br"
+ dest="${output}/asf-logo.gif" />
+ <au:assertFilesMatch expected="../resources/asf-logo.gif"
+ actual="${output}/asf-logo.gif"/>
+ </target>
+
+ <target name="testWithResource" depends="setUp">
+ <cmp:unbrotli dest="${output}/asf-logo.gif">
+ <file file="../resources/asf-logo.gif.br"/>
+ </cmp:unbrotli>
+ <au:assertFilesMatch expected="../resources/asf-logo.gif"
+ actual="${output}/asf-logo.gif"/>
+ </target>
+
+
+</project>
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/0d561ceb/src/tests/resources/asf-logo.gif.br
----------------------------------------------------------------------
diff --git a/src/tests/resources/asf-logo.gif.br b/src/tests/resources/asf-logo.gif.br
new file mode 100644
index 0000000..4ae17e2
Binary files /dev/null and b/src/tests/resources/asf-logo.gif.br differ
[12/12] ant-antlibs-compress git commit: make support all
known archive formats
Posted by bo...@apache.org.
make <archives> support all known archive formats
Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/9668aba3
Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/9668aba3
Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/9668aba3
Branch: refs/heads/master
Commit: 9668aba32c20688813ca812f8162afe9428e0c76
Parents: 6780141
Author: Stefan Bodewig <bo...@apache.org>
Authored: Tue May 9 06:01:44 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Tue May 9 06:01:44 2017 +0200
----------------------------------------------------------------------
docs/archives.html | 14 +++--
.../apache/ant/compress/resources/Archives.java | 63 ++++++++++++++++++++
src/tests/antunit/archives-test.xml | 45 ++++++++++++++
3 files changed, 118 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/9668aba3/docs/archives.html
----------------------------------------------------------------------
diff --git a/docs/archives.html b/docs/archives.html
index 3ced66d..469a62b 100644
--- a/docs/archives.html
+++ b/docs/archives.html
@@ -36,16 +36,22 @@
<h3>Parameters specified as nested elements</h3>
- <p><code><archives></code> has four nested
- elements <code><ars></code>, <code><cpios></code>,
- <code><zips></code> and
- <code><tars></code> that are <a href="http://ant.apache.org/manual/CoreTypes/resources.html#union">unions</a>
+ <p><code><archives></code> has seven nested
+ elements <code><ars></code>, <code><arjs></code>, <code><cpios></code>,
+ <code><dumps></code>, <code><sevenzs></code>, <code><zips></code>
+ and
+ <code><tars></code> that
+ are <a href="http://ant.apache.org/manual/CoreTypes/resources.html#union">unions</a>
themselves, i.e. they accept arbitrary many resource(collection)s
as nested elements.</p>
<p>The nested resources of <zips> are treated as ZIP archives,
the nested resources of <tars> as TAR archives and so on.</p>
+ <p>Support for nested <code>arjs</code>, <code>dumps</code>
+ and <code>sevenzs</code> has been added with the Compress Antlib
+ 1.5.</p>
+
<h4>Examples</h4>
<p>Copies all files from all jars that are on the classpath
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/9668aba3/src/main/org/apache/ant/compress/resources/Archives.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/ant/compress/resources/Archives.java b/src/main/org/apache/ant/compress/resources/Archives.java
index 27b85cc..dffa815 100644
--- a/src/main/org/apache/ant/compress/resources/Archives.java
+++ b/src/main/org/apache/ant/compress/resources/Archives.java
@@ -42,6 +42,9 @@ public class Archives extends DataType
private Union tars = new Union();
private Union ars = new Union();
private Union cpios = new Union();
+ private Union arjs = new Union();
+ private Union dumps = new Union();
+ private Union sevenzs = new Union();
/**
* Wrapper to identify nested resource collections as ZIP
@@ -80,6 +83,19 @@ public class Archives extends DataType
}
/**
+ * Wrapper to identify nested resource collections as ARJ
+ * archives.
+ * @since Apache Compress Antlib 1.5
+ */
+ public Union createArjs() {
+ if (isReference()) {
+ throw noChildrenAllowed();
+ }
+ setChecked(false);
+ return arjs;
+ }
+
+ /**
* Wrapper to identify nested resource collections as CPIO
* archives.
*/
@@ -92,6 +108,32 @@ public class Archives extends DataType
}
/**
+ * Wrapper to identify nested resource collections as Unix dump
+ * archives.
+ * @since Apache Compress Antlib 1.5
+ */
+ public Union createDumps() {
+ if (isReference()) {
+ throw noChildrenAllowed();
+ }
+ setChecked(false);
+ return dumps;
+ }
+
+ /**
+ * Wrapper to identify nested resource collections as 7z
+ * archives.
+ * @since Apache Compress Antlib 1.5
+ */
+ public Union createSevenzs() {
+ if (isReference()) {
+ throw noChildrenAllowed();
+ }
+ setChecked(false);
+ return sevenzs;
+ }
+
+ /**
* Sums the sizes of nested archives.
*/
@Override
@@ -145,6 +187,9 @@ public class Archives extends DataType
if (zips.getResourceCollections().size() > 0
|| ars.getResourceCollections().size() > 0
|| cpios.getResourceCollections().size() > 0
+ || arjs.getResourceCollections().size() > 0
+ || dumps.getResourceCollections().size() > 0
+ || sevenzs.getResourceCollections().size() > 0
|| tars.getResourceCollections().size() > 0) {
throw tooManyAttributes();
}
@@ -164,6 +209,9 @@ public class Archives extends DataType
a.tars = (Union) tars.clone();
a.ars = (Union) ars.clone();
a.cpios = (Union) cpios.clone();
+ a.arjs = (Union) arjs.clone();
+ a.dumps = (Union) dumps.clone();
+ a.sevenzs = (Union) sevenzs.clone();
return a;
} catch (CloneNotSupportedException e) {
throw new BuildException(e);
@@ -194,6 +242,18 @@ public class Archives extends DataType
l.add(configureArchive(new CpioFileSet(),
(Resource) iter.next()));
}
+ for (Iterator iter = arjs.iterator(); iter.hasNext(); ) {
+ l.add(configureArchive(new ArjFileSet(),
+ (Resource) iter.next()));
+ }
+ for (Iterator iter = dumps.iterator(); iter.hasNext(); ) {
+ l.add(configureArchive(new DumpFileSet(),
+ (Resource) iter.next()));
+ }
+ for (Iterator iter = sevenzs.iterator(); iter.hasNext(); ) {
+ l.add(configureArchive(new SevenZFileSet(),
+ (Resource) iter.next()));
+ }
return l.iterator();
}
@@ -228,6 +288,9 @@ public class Archives extends DataType
pushAndInvokeCircularReferenceCheck(tars, stk, p);
pushAndInvokeCircularReferenceCheck(ars, stk, p);
pushAndInvokeCircularReferenceCheck(cpios, stk, p);
+ pushAndInvokeCircularReferenceCheck(arjs, stk, p);
+ pushAndInvokeCircularReferenceCheck(dumps, stk, p);
+ pushAndInvokeCircularReferenceCheck(sevenzs, stk, p);
setChecked(true);
}
}
http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/9668aba3/src/tests/antunit/archives-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/archives-test.xml b/src/tests/antunit/archives-test.xml
index 7fa8fde..2453cb4 100644
--- a/src/tests/antunit/archives-test.xml
+++ b/src/tests/antunit/archives-test.xml
@@ -90,6 +90,51 @@
<au:assertFileExists file="${output}/cpio/${filename}"/>
</target>
+ <target name="testArj">
+ <mkdir dir="${output}"/>
+ <copy todir="${output}">
+ <cmp:archives>
+ <arjs>
+ <file file="../resources/asf-logo.gif.arj"/>
+ </arjs>
+ </cmp:archives>
+ </copy>
+ <au:assertFilesMatch
+ actual="${output}/asf-logo.gif"
+ expected="../resources/asf-logo.gif"
+ />
+ </target>
+
+ <target name="testDump">
+ <mkdir dir="${output}"/>
+ <copy todir="${output}">
+ <cmp:archives>
+ <dumps>
+ <file file="../resources/asf-logo.gif.dump"/>
+ </dumps>
+ </cmp:archives>
+ </copy>
+ <au:assertFilesMatch
+ actual="${output}/asf-logo.gif"
+ expected="../resources/asf-logo.gif"
+ />
+ </target>
+
+ <target name="test7z">
+ <mkdir dir="${output}"/>
+ <copy todir="${output}">
+ <cmp:archives>
+ <sevenzs>
+ <file file="../resources/asf-logo.gif.7z"/>
+ </sevenzs>
+ </cmp:archives>
+ </copy>
+ <au:assertFilesMatch
+ actual="${output}/asf-logo.gif"
+ expected="../resources/asf-logo.gif"
+ />
+ </target>
+
<target name="testReference" depends="-findAntHomeLib">
<mkdir dir="${output}"/>
<cmp:archives id="ref">