org.apache.tomcat.util.scan

## Interface Jar

- All Known Implementing Classes:
    FileUrlJar, UrlJar

      public interface Jar

  Provides an abstraction for use by the various classes that need to scan JARs. The classes provided by the JRE for accessing JARs (`JarFile` and `JarInputStream`) have significantly different performance characteristics depending on the form of the URL used to access the JAR. For file based JAR `URL`s, `JarFile` is faster but for non-file based `URL`s, `JarFile` creates a copy of the JAR in the temporary directory so `JarInputStream` is faster.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close any resources associated with this JAR.
    `boolean` | `entryExists(String name)` Determines if a specific entry exists within the JAR.
    `InputStream` | `getEntryInputStream()` Obtains the input stream for the current entry.
    `String` | `getEntryName()` Obtains the name of the current entry.
    `InputStream` | `getInputStream(String name)` Obtain an `InputStream` for a given entry in a JAR.
    `void` | `nextEntry()` Moves the internal pointer to the next entry in the JAR.
    `void` | `reset()` Resets the internal pointer used to track JAR entries to the beginning of the JAR.

- - ### Method Detail

    - #### entryExists

          boolean entryExists(String name)
                              throws IOException

      Determines if a specific entry exists within the JAR.
      Parameters:
        `name` - Entry to look for
      Returns:
        `true` if the specified entry exists else `false`
      Throws:
        `IOException`

    - #### getInputStream

          InputStream getInputStream(String name)
                                     throws IOException

      Obtain an `InputStream` for a given entry in a JAR. The caller is responsible for closing the stream.
      Parameters:
        `name` - Entry to obtain an `InputStream` for
      Returns:
        An `InputStream` for the specified entry or null if the entry does not exist
      Throws:
        `IOException`

    - #### close

          void close()

      Close any resources associated with this JAR.

    - #### nextEntry

          void nextEntry()

      Moves the internal pointer to the next entry in the JAR.

    - #### getEntryName

          String getEntryName()

      Obtains the name of the current entry.
      Returns:
        The entry name

    - #### getEntryInputStream

          InputStream getEntryInputStream()
                                          throws IOException

      Obtains the input stream for the current entry.
      Returns:
        The input stream
      Throws:
        `IOException` - If the stream cannot be obtained

    - #### reset

          void reset()
                     throws IOException

      Resets the internal pointer used to track JAR entries to the beginning of the JAR.
      Throws:
        `IOException` - If the pointer cannot be reset

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.