JavaConstantResource (Apache Ant API)
Date: 2021-07-10

org.apache.tools.ant.types.resources

## Class JavaConstantResource

- 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.JavaConstantResource

- All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable<Resource>, java.lang.Iterable<Resource>, ResourceCollection

      public class JavaConstantResource
      extends AbstractClasspathResource

  A resource that is a java constant. This lets you extract values off the classpath and use them elsewhere
  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.types.DataType

      `checked, ref`

    - ### Fields inherited from class org.apache.tools.ant.ProjectComponent

      `description, location, project`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JavaConstantResource()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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, compareTo, 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 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`

- - ### Constructor Detail

    - #### JavaConstantResource

          public JavaConstantResource()

  - ### Method Detail

    - #### 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.