Top Description Fields Constructors Methods
org.apache.tomcat.util.scan

public Class JarFileUrlJar

extends Object
implements Jar
Class Inheritance
All Implemented Interfaces
org.apache.tomcat.Jar, java.lang.AutoCloseable
Imports
java.io.File, .IOException, .InputStream, java.net.JarURLConnection, .URISyntaxException, .URL, java.util.Enumeration, .HashSet, .Set, java.util.jar.JarEntry, .JarFile, .Manifest, java.util.zip.ZipEntry, .ZipFile, org.apache.tomcat.Jar

Implementation of Jar that is optimised for file based JAR URLs that refer directly to a JAR file (e.g URLs of the form jar:file: ... .jar!/ or file:... .jar).

Field Summary

Modifier and TypeField and Description
private Enumeration<JarEntry>
private JarEntry
private Set<String>
private final JarFile
private final URL
private final boolean

Constructor Summary

AccessConstructor and Description
public
JarFileUrlJar(URL url, boolean startsWithJar)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements org.apache.tomcat.Jar.close.

Close any resources associated with this JAR.

public boolean
exists(String
Entry to look for
name
)

Implements org.apache.tomcat.Jar.exists.

Determine if the given resource in present in the JAR.

public InputStream
getEntryInputStream()

Implements org.apache.tomcat.Jar.getEntryInputStream.

Obtains the input stream for the current entry.

public String
getEntryName()

Implements org.apache.tomcat.Jar.getEntryName.

Obtains the name of the current entry.

public InputStream
getInputStream(String
Entry to obtain an InputStream for
name
)

Implements org.apache.tomcat.Jar.getInputStream.

Obtain an InputStream for a given entry in a JAR.

public URL
public long
getLastModified(String
Entry to obtain the modification time for
name
)

Implements org.apache.tomcat.Jar.getLastModified.

Obtain the last modified time for the given resource in the JAR.

public Manifest
getManifest()

Implements org.apache.tomcat.Jar.getManifest.

Obtain the manifest for the JAR file.

public String
getURL(String
The entry to generate the URL for
entry
)

Implements org.apache.tomcat.Jar.getURL.

Obtain, in String form, the URL for an entry in this JAR.

public void
nextEntry()

Implements org.apache.tomcat.Jar.nextEntry.

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

public void
reset()

Implements org.apache.tomcat.Jar.reset.

Resets the internal pointer used to track JAR entries to the beginning of the JAR.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

entriesback to summary
private Enumeration<JarEntry> entries
entryback to summary
private JarEntry entry
entryNamesSeenback to summary
private Set<String> entryNamesSeen
jarFileback to summary
private final JarFile jarFile
jarFileURLback to summary
private final URL jarFileURL
multiReleaseback to summary
private final boolean multiRelease

Constructor Detail

JarFileUrlJarback to summary
public JarFileUrlJar(URL url, boolean startsWithJar) throws IOException

Method Detail

closeback to summary
public void close()

Implements org.apache.tomcat.Jar.close.

Doc from org.apache.tomcat.Jar.close.

Close any resources associated with this JAR.

Annotations
@Override
existsback to summary
public boolean exists(String name) throws IOException

Implements org.apache.tomcat.Jar.exists.

Doc from org.apache.tomcat.Jar.exists.

Determine if the given resource in present in the JAR.

Parameters
name:String

Entry to look for

Returns:boolean

true if the entry is present in the JAR, otherwise false

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs while processing the JAR file
getEntryInputStreamback to summary
public InputStream getEntryInputStream() throws IOException

Implements org.apache.tomcat.Jar.getEntryInputStream.

Doc from org.apache.tomcat.Jar.getEntryInputStream.

Obtains the input stream for the current entry.

Returns:InputStream

The input stream

Annotations
@Override
Exceptions
IOException:
If the stream cannot be obtained
getEntryNameback to summary
public String getEntryName()

Implements org.apache.tomcat.Jar.getEntryName.

Doc from org.apache.tomcat.Jar.getEntryName.

Obtains the name of the current entry.

Returns:String

The entry name

Annotations
@Override
getInputStreamback to summary
public InputStream getInputStream(String name) throws IOException

Implements org.apache.tomcat.Jar.getInputStream.

Doc from org.apache.tomcat.Jar.getInputStream.

Obtain an InputStream for a given entry in a JAR. The caller is responsible for closing the stream.

Parameters
name:String

Entry to obtain an InputStream for

Returns:InputStream

An InputStream for the specified entry or null if the entry does not exist

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs while processing the JAR file
getJarFileURLback to summary
public URL getJarFileURL()

Implements org.apache.tomcat.Jar.getJarFileURL.

Returns:URL

Doc from org.apache.tomcat.Jar.getJarFileURL.

The URL for accessing the JAR file.

Annotations
@Override
getLastModifiedback to summary
public long getLastModified(String name) throws IOException

Implements org.apache.tomcat.Jar.getLastModified.

Doc from org.apache.tomcat.Jar.getLastModified.

Obtain the last modified time for the given resource in the JAR.

Parameters
name:String

Entry to obtain the modification time for

Returns:long

The time (in the same format as System#currentTimeMillis() that the resource was last modified. Returns -1 if the entry does not exist

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs while processing the JAR file
getManifestback to summary
public Manifest getManifest() throws IOException

Implements org.apache.tomcat.Jar.getManifest.

Doc from org.apache.tomcat.Jar.getManifest.

Obtain the manifest for the JAR file.

Returns:Manifest

The manifest for this JAR file.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs trying to obtain the manifest
getURLback to summary
public String getURL(String entry)

Implements org.apache.tomcat.Jar.getURL.

Doc from org.apache.tomcat.Jar.getURL.

Obtain, in String form, the URL for an entry in this JAR. Note that for JARs nested in WAR files, the Tomcat specific war:file:... form will not be used, rather the jar:jar:file:... form (that the JRE does not understand will be used). Note that this means that any code using these URLs will need to understand the jar:jar:file:... form and use the org.apache.tomcat.util.scan.JarFactory to ensure resources are accessed correctly.

Parameters
entry:String

The entry to generate the URL for

Returns:String

a URL for the specified entry in the JAR

Annotations
@Override
nextEntryback to summary
public void nextEntry()

Implements org.apache.tomcat.Jar.nextEntry.

Doc from org.apache.tomcat.Jar.nextEntry.

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

Annotations
@Override
resetback to summary
public void reset() throws IOException

Implements org.apache.tomcat.Jar.reset.

Doc from org.apache.tomcat.Jar.reset.

Resets the internal pointer used to track JAR entries to the beginning of the JAR.

Annotations
@Override
Exceptions
IOException:
If the pointer cannot be reset