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:
Cloneable
,Comparable<Resource>
,Iterable<Resource>
,ResourceCollection
,URLProvider
A Resource representation of something loadable via a Java classloader.
- Since:
- Ant 1.7
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.tools.ant.types.resources.AbstractClasspathResource
AbstractClasspathResource.ClassLoaderWithFlag
-
Field Summary
Fields inherited from class org.apache.tools.ant.types.Resource
MAGIC, UNKNOWN_DATETIME, UNKNOWN_SIZE
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
-
Constructor Summary
ConstructorDescriptionDefault constructor.JavaResource
(String name, Path path) Construct a new JavaResource using the specified name and classpath. -
Method Summary
Modifier and TypeMethodDescriptionint
Compare this JavaResource to another Resource.protected JavaResource
getRef()
Perform the check for circular references and return the referenced Resource.getURL()
Get the URL represented by this Resource.protected InputStream
open the input stream from a specific classloaderMethods 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, asOptional, 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, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes
Methods inherited from class org.apache.tools.ant.ProjectComponent
getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.apache.tools.ant.types.ResourceCollection
isEmpty, stream
-
Constructor Details
-
JavaResource
public JavaResource()Default constructor. -
JavaResource
-
-
Method Details
-
openInputStream
open the input stream from a specific classloader- Specified by:
openInputStream
in classAbstractClasspathResource
- 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.
-
getURL
Get the URL represented by this Resource.- Specified by:
getURL
in interfaceURLProvider
- Returns:
- the file.
- Since:
- Ant 1.8.0
-
compareTo
Compare this JavaResource to another Resource.- Specified by:
compareTo
in interfaceComparable<Resource>
- Overrides:
compareTo
in classResource
- 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.
-
getRef
Description copied from class:Resource
Perform the check for circular references and return the referenced Resource.- Overrides:
getRef
in classAbstractClasspathResource
- Returns:
Resource
.
-