UrlJar (Apache Tomcat 7.0.104 API Documentation)

org.apache.tomcat.util.scan

## Class UrlJar

- java.lang.Object
- - org.apache.tomcat.util.scan.UrlJar

- All Implemented Interfaces:
    Jar

      public class UrlJar
      extends Object
      implements Jar

  Implementation of `Jar` that is optimised for non-file based JAR URLs (e.g. JNDI based URLs of the form jar:jndi:...).

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `UrlJar(URL url)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close any resources associated with this JAR.
    `boolean` | `entryExists(String name)` Deprecated.
    `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.

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### UrlJar

          public UrlJar(URL url)
                 throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### entryExists

          @Deprecated
          public boolean entryExists(String name)
                              throws IOException

      Deprecated.
      Description copied from interface: `Jar`
      Determines if a specific entry exists within the JAR.
      Specified by:
        `entryExists` in interface `Jar`
      Parameters:
        `name` - Entry to look for
      Returns:
        Implementations will always return `false`
      Throws:
        `IOException` - if an I/O error occurs while processing the JAR file entries

    - #### getInputStream

          public InputStream getInputStream(String name)
                                     throws IOException

      Description copied from interface: `Jar`
      Obtain an `InputStream` for a given entry in a JAR. The caller is responsible for closing the stream.
      Specified by:
        `getInputStream` in interface `Jar`
      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

          public void close()

      Description copied from interface: `Jar`
      Close any resources associated with this JAR.
      Specified by:
        `close` in interface `Jar`

    - #### nextEntry

          public void nextEntry()

      Description copied from interface: `Jar`
      Moves the internal pointer to the next entry in the JAR.
      Specified by:
        `nextEntry` in interface `Jar`

    - #### getEntryName

          public String getEntryName()

      Description copied from interface: `Jar`
      Obtains the name of the current entry.
      Specified by:
        `getEntryName` in interface `Jar`
      Returns:
        The entry name

    - #### getEntryInputStream

          public InputStream getEntryInputStream()
                                          throws IOException

      Description copied from interface: `Jar`
      Obtains the input stream for the current entry.
      Specified by:
        `getEntryInputStream` in interface `Jar`
      Returns:
        The input stream
      Throws:
        `IOException` - If the stream cannot be obtained

    - #### reset

          public void reset()
                     throws IOException

      Description copied from interface: `Jar`
      Resets the internal pointer used to track JAR entries to the beginning of the JAR.
      Specified by:
        `reset` in interface `Jar`
      Throws:
        `IOException` - If the pointer cannot be reset

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