JarFileIterator (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs.optional.depend, class: JarFileIterator

# Class JarFileIterator

java.lang.Object
org.apache.tools.ant.taskdefs.optional.depend.JarFileIterator

All Implemented Interfaces:
  `Iterable<ClassFile>, ClassFileIterator`

public class JarFileIterator extends Object implements ClassFileIterator
A class file iterator which iterates through the contents of a Java jar file.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JarFileIterator(InputStream stream)`
  Construct an iterator over a jar stream

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ClassFile`
  `getNextClassFile()`
  Get the next ClassFile object from the jar

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface ClassFileIterator

  `iterator`
  Modifier and Type
  Method
  Description
  `default Iterator<ClassFile>`
  `iterator()`

  ### Methods inherited from interface Iterable

  `forEach, spliterator`

- ## Constructor Details

  - ### JarFileIterator

    public JarFileIterator(InputStream stream) throws IOException
    Construct an iterator over a jar stream
    Parameters:
      `stream` - the basic input stream from which the Jar is received
    Throws:
      `IOException` - if the jar stream cannot be created

- ## Method Details

  - ### getNextClassFile

    public ClassFile getNextClassFile()
    Get the next ClassFile object from the jar
    Specified by:
      `getNextClassFile` in interface `ClassFileIterator`
    Returns:
      a ClassFile object describing the class from the jar