org.springframework.data.hadoop.util
Class ResourceUtils

java.lang.Object
  extended by org.springframework.data.hadoop.util.ResourceUtils

public abstract class ResourceUtils
extends Object

Utility class for dealing or location resources for Hadoop jobs.

Author:
Costin Leau, Arjen Poutsma

Constructor Summary
ResourceUtils()
           
 
Method Summary
static String decode(String source)
          Decodes the given encoded source String into an URI.
static Resource findContainingJar(Class<?> clazz)
          Locates the jar (within the classpath) containing the given class.
static Resource findContainingJar(ClassLoader loader, String resourceName)
          Locates a jar (within the classpath) containing the given resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceUtils

public ResourceUtils()
Method Detail

findContainingJar

public static Resource findContainingJar(Class<?> clazz)
Locates the jar (within the classpath) containing the given class. As this method requires loading a class, it's recommended to use findContainingJar(ClassLoader, String) instead.

Parameters:
clazz - the class to look for
Returns:
the containing jar.

findContainingJar

public static Resource findContainingJar(ClassLoader loader,
                                         String resourceName)
Locates a jar (within the classpath) containing the given resource.

Parameters:
loader - class loader to use for locating the jar
resourceName - resource to look for
Returns:
the containing jar

decode

public static String decode(String source)
Decodes the given encoded source String into an URI. Based on the following rules:

Parameters:
source - the source string
Returns:
the decoded URI
Throws:
UnsupportedEncodingException - when the given encoding parameter is not supported
See Also:
URLDecoder.decode(String, String)