public final class ResourceUtils extends LoggedObject
| Constructor and Description |
|---|
ResourceUtils() |
| Modifier and Type | Method and Description |
|---|---|
void |
copyResource(String resourceName,
File destFile)
Copies a container resource from the JAR into the specified file.
|
void |
copyResource(String resourceName,
File destFile,
org.apache.tools.ant.types.FilterChain filterChain,
String encoding)
Copies a container resource from the JAR into the specified file, thereby applying the
specified filters.
|
void |
copyResource(String resourceName,
String destFile,
FileHandler handler)
Copies a container resource from the JAR into the specified file using the specified file
handler.
|
void |
copyResource(String resourceName,
String destFile,
FileHandler handler,
org.apache.tools.ant.types.FilterChain filterChain,
String encoding)
Copies a container resource from the JAR into the specified file, using the specified file
handler thereby applying the specified filters.
|
static ClassLoader |
getResourceLoader() |
File |
getResourceLocation(Class where,
String resourceName)
Search for the given resource and return the directory or archive that contains it.
|
static void |
setResourceLoader(ClassLoader resourceLoader) |
getLogger, setLoggerpublic static ClassLoader getResourceLoader()
getResourceAsStream calls.public static void setResourceLoader(ClassLoader resourceLoader)
resourceLoader - Class loader used for the getResourceAsStream calls.public void copyResource(String resourceName, File destFile) throws IOException
resourceName - The name of the resourcedestFile - The file to which the contents of the resource should be copiedIOException - If an I/O error occurs while copying the resourcepublic void copyResource(String resourceName, String destFile, FileHandler handler) throws IOException
resourceName - The name of the resourcedestFile - The file to which the contents of the resource should be copiedhandler - The file handler to useIOException - If an I/O error occurs while copying the resourcepublic void copyResource(String resourceName, File destFile, org.apache.tools.ant.types.FilterChain filterChain, String encoding) throws IOException
resourceName - The name of the resource, relative to the
org.codehaus.cargo.container.internal.util packagedestFile - The file to which the contents of the resource should be copiedfilterChain - The ordered list of filter readers that should be applied while copyingencoding - The encoding that should be used when copying the resource. Use null for
system default encodingIOException - If an I/O error occurs while copying the resourcepublic void copyResource(String resourceName, String destFile, FileHandler handler, org.apache.tools.ant.types.FilterChain filterChain, String encoding) throws IOException
resourceName - The name of the resource, relative to the
org.codehaus.cargo.container.internal.util packagedestFile - The file to which the contents of the resource should be copiedhandler - The file handler to be used for file copyfilterChain - The ordered list of filter readers that should be applied while copyingencoding - The encoding that should be used when copying the resource. Use null for
system default encodingIOException - If an I/O error occurs while copying the resourcepublic File getResourceLocation(Class where, String resourceName)
Doesn't work for archives in JDK 1.1 as the URL returned by getResource doesn't contain the name of the archive.
where - Class where to look for the resource (its class loader and parent class loaders
are used recursively for the lookup).resourceName - The name of the resourceCopyright © 2004-2013 Codehaus. All Rights Reserved.