org.apache.cactus.integration.ant.util
Class ResourceUtils

java.lang.Object
  extended byorg.apache.cactus.integration.ant.util.ResourceUtils

public final class ResourceUtils
extends java.lang.Object

Utility class that provides a couple of methods for extracting files stored as resource in a JAR.

Version:
$Id: ResourceUtils.java,v 1.10 2003/06/09 10:13:09 cmlenz Exp $
Author:
Christopher Lenz

Method Summary
static void copyResource(org.apache.tools.ant.Project theProject, java.lang.String theResourceName, java.io.File theDestFile)
          Copies a container resource from the JAR into the specified file.
static void copyResource(org.apache.tools.ant.Project theProject, java.lang.String theResourceName, java.io.File theDestFile, org.apache.tools.ant.types.FilterChain theFilterChain)
          Copies a container resource from the JAR into the specified file, thereby applying the specified filters.
static java.io.File getResourceLocation(java.lang.String theResourceName)
          Search for the given resource and return the directory or archive that contains it.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copyResource

public static void copyResource(org.apache.tools.ant.Project theProject,
                                java.lang.String theResourceName,
                                java.io.File theDestFile)
                         throws java.io.IOException
Copies a container resource from the JAR into the specified file.

Parameters:
theProject - The Ant project
theResourceName - The name of the resource, relative to the org.apache.cactus.integration.ant.container package
theDestFile - The file to which the contents of the resource should be copied
Throws:
java.io.IOException - If an I/O error occurs while copying the resource

copyResource

public static void copyResource(org.apache.tools.ant.Project theProject,
                                java.lang.String theResourceName,
                                java.io.File theDestFile,
                                org.apache.tools.ant.types.FilterChain theFilterChain)
                         throws java.io.IOException
Copies a container resource from the JAR into the specified file, thereby applying the specified filters.

Parameters:
theProject - The Ant project
theResourceName - The name of the resource, relative to the org.apache.cactus.integration.ant.container package
theDestFile - The file to which the contents of the resource should be copied
theFilterChain - The ordered list of filter readers that should be applied while copying
Throws:
java.io.IOException - If an I/O error occurs while copying the resource

getResourceLocation

public static java.io.File getResourceLocation(java.lang.String theResourceName)
Search for the given resource and return the directory or archive that contains it.

Doesn't work for archives in JDK 1.1 as the URL returned by getResource doesn't contain the name of the archive.

Parameters:
theResourceName - The name of the resource
Returns:
The directory or archive containing the specified resource


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.