org.apache.tools.ant.types.resources
Class JavaResource
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.tools.ant.types.Resource
org.apache.tools.ant.types.resources.AbstractClasspathResource
org.apache.tools.ant.types.resources.JavaResource
- All Implemented Interfaces:
- java.lang.Cloneable, java.lang.Comparable<Resource>, java.lang.Iterable<Resource>, ResourceCollection, URLProvider
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(java.lang.String name,
Path path)
Construct a new JavaResource using the specified name and
classpath. |
Method Summary |
int |
compareTo(Resource another)
Compare this JavaResource to another Resource. |
java.net.URL |
getURL()
Get the URL represented by this Resource. |
protected java.io.InputStream |
openInputStream(java.lang.ClassLoader cl)
open the input stream from a specific classloader |
Methods inherited from class org.apache.tools.ant.types.resources.AbstractClasspathResource |
createClasspath, dieOnCircularReference, getClassLoader, getClasspath, getInputStream, getLoader, isExists, setClasspath, setClasspathRef, setLoaderRef, setParentFirst, setRefid |
Methods inherited from class org.apache.tools.ant.types.Resource |
as, clone, equals, getLastModified, getMagicNumber, getName, getOutputStream, getSize, hashCode, isDirectory, isFilesystemOnly, iterator, setDirectory, setExists, setLastModified, setName, setSize, size, toLongString, toString |
Methods inherited from class org.apache.tools.ant.types.DataType |
checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
JavaResource
public JavaResource()
- Default constructor.
JavaResource
public JavaResource(java.lang.String name,
Path path)
- Construct a new JavaResource using the specified name and
classpath.
- Parameters:
name
- the resource name.path
- the classpath.
openInputStream
protected java.io.InputStream openInputStream(java.lang.ClassLoader cl)
throws java.io.IOException
- open the input stream from a specific classloader
- Specified by:
openInputStream
in class AbstractClasspathResource
- Parameters:
cl
- the classloader to use. Will be null if the system
classloader is used
- Returns:
- an open input stream for the resource
- Throws:
java.io.IOException
- if an error occurs.
getURL
public java.net.URL getURL()
- Get the URL represented by this Resource.
- Specified by:
getURL
in interface URLProvider
- Returns:
- the file.
- Since:
- Ant 1.8.0
compareTo
public int compareTo(Resource another)
- Compare this JavaResource to another Resource.
- Specified by:
compareTo
in interface java.lang.Comparable<Resource>
- Overrides:
compareTo
in class 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.