LoaderUtils (Apache Ant API)
Keywords: org.apache.tools.ant.util.LoaderUtils,LoaderUtils class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.util
Class LoaderUtils

    java.lang.Object
      |
      +--org.apache.tools.ant.util.LoaderUtils

public class LoaderUtils
extends java.lang.Object

ClassLoader utility methods

Constructor Summary
`LoaderUtils()`

Method Summary
`static java.io.File` | `getClassSource(java.lang.Class c)` Find the directory or jar file the class has been loaded from.
`static java.lang.ClassLoader` | `getContextClassLoader()` JDK1.1 compatible access to set the context class loader.
`static java.io.File` | `getResourceSource(java.lang.ClassLoader c, java.lang.String resource)` Find the directory or a give resource has been loaded from.
`static boolean` | `isContextLoaderAvailable()` Indicates if the context class loader methods are available
`static void` | `setContextClassLoader(java.lang.ClassLoader loader)` Set the context classloader

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LoaderUtils

    public LoaderUtils()

Method Detail

### setContextClassLoader

    public static void setContextClassLoader(java.lang.ClassLoader loader)

  Set the context classloader

  Parameters:
    `loader` - the ClassLoader to be used as the context class loader on the current thread.

### getContextClassLoader

    public static java.lang.ClassLoader getContextClassLoader()

  JDK1.1 compatible access to set the context class loader.

  Returns:
    the ClassLoader instance being used as the context classloader on the current thread. Returns null on JDK 1.1

### isContextLoaderAvailable

    public static boolean isContextLoaderAvailable()

  Indicates if the context class loader methods are available

  Returns:
    true if the get and set methods dealing with the context classloader are available.

### getClassSource

    public static java.io.File getClassSource(java.lang.Class c)

  Find the directory or jar file the class has been loaded from.

  Parameters:
    `c` - the class whose location is required.
  Returns:
    the file or jar with the class or null if we cannot determine the location.
  Since:
    Ant 1.6

### getResourceSource

    public static java.io.File getResourceSource(java.lang.ClassLoader c,
                                                 java.lang.String resource)

  Find the directory or a give resource has been loaded from.

  Parameters:
    `c` - the classloader to be consulted for the source
    `resource` - the resource whose location is required.
  Returns:
    the file with the resource source or null if we cannot determine the location.
  Since:
    Ant 1.6

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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