org.apache.tools.ant.types.resources

Class JavaResource

public class JavaResource extends AbstractClasspathResource implements URLProvider

A Resource representation of something loadable via a Java classloader.

Since: Ant 1.7

Constructor Summary
JavaResource()
Default constructor.
JavaResource(String name, Path path)
Construct a new JavaResource using the specified name and classpath.
Method Summary
intcompareTo(Object another)
Compare this JavaResource to another Resource.
URLgetURL()
Get the URL represented by this Resource.
protected InputStreamopenInputStream(ClassLoader cl)
open the input stream from a specific classloader

Constructor Detail

JavaResource

public JavaResource()
Default constructor.

JavaResource

public JavaResource(String name, Path path)
Construct a new JavaResource using the specified name and classpath.

Parameters: name the resource name. path the classpath.

Method Detail

compareTo

public int compareTo(Object another)
Compare this JavaResource to another Resource.

Parameters: another the other Resource against which to compare.

Returns: a negative integer, zero, or a positive integer as this JavaResource is less than, equal to, or greater than the specified Resource.

getURL

public URL getURL()
Get the URL represented by this Resource.

Since: Ant 1.8.0

openInputStream

protected InputStream openInputStream(ClassLoader cl)
open the input stream from a specific classloader

Parameters: cl the classloader to use. Will be null if the system classloader is used

Returns: an open input stream for the resource

Throws: IOException if an error occurs.