From df7e805e857e746a9ab7f6cf989a8dff55162543 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Fri, 28 Nov 2008 05:37:17 +0000 Subject: [PATCH] Initial version of a resource collection that extracts archives nested as resources. PR 46257. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@721344 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/types/defaults.properties | 1 + .../org/apache/tools/ant/util/CollectionUtils.java | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/main/org/apache/tools/ant/types/defaults.properties b/src/main/org/apache/tools/ant/types/defaults.properties index 369361ce2..91bc4f62d 100644 --- a/src/main/org/apache/tools/ant/types/defaults.properties +++ b/src/main/org/apache/tools/ant/types/defaults.properties @@ -75,6 +75,7 @@ last=org.apache.tools.ant.types.resources.Last tarfileset=org.apache.tools.ant.types.TarFileSet tokens=org.apache.tools.ant.types.resources.Tokens mappedresources=org.apache.tools.ant.types.resources.MappedResourceCollection +archives=org.apache.tools.ant.types.resources.Archives #Resources (single-element ResourceCollections): resource=org.apache.tools.ant.types.Resource diff --git a/src/main/org/apache/tools/ant/util/CollectionUtils.java b/src/main/org/apache/tools/ant/util/CollectionUtils.java index 9195d2658..da112c8c7 100644 --- a/src/main/org/apache/tools/ant/util/CollectionUtils.java +++ b/src/main/org/apache/tools/ant/util/CollectionUtils.java @@ -208,6 +208,19 @@ public class CollectionUtils { }; } + /** + * Returns a collection containg all elements of the iterator. + * + * @since Ant 1.8.0 + */ + public static Collection asCollection(final Iterator iter) { + List l = new ArrayList(); + while (iter.hasNext()) { + l.add(iter.next()); + } + return l; + } + private static final class CompoundEnumeration implements Enumeration { private final Enumeration e1, e2;