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

public abstract Class AbstractInputStreamJar

extends Object
implements Jar
Class Inheritance
All Implemented Interfaces
org.apache.tomcat.Jar, java.lang.AutoCloseable
Known Direct Subclasses
org.apache.tomcat.util.scan.JarFileUrlNestedJar, org.apache.tomcat.util.scan.UrlJar
Imports
java.io.IOException, .InputStream, java.net.URL, java.util.HashMap, .Map, .Map.Entry, java.util.jar.JarEntry, .Manifest, org.apache.tomcat.Jar

Base implementation of Jar for implementations that use a JarInputStream to access the JAR file.

Field Summary

Modifier and TypeField and Description
private JarEntry
private final URL
private NonClosingJarInputStream
private Map<String, String>
private Boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
protected abstract NonClosingJarInputStream
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.

private void
public void
nextEntry()

Implements org.apache.tomcat.Jar.nextEntry.

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

private void
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

entryback to summary
private JarEntry entry
jarFileURLback to summary
private final URL jarFileURL
jarInputStreamback to summary
private NonClosingJarInputStream jarInputStream
mrMapback to summary
private Map<String, String> mrMap
multiReleaseback to summary
private Boolean multiRelease

Constructor Detail

AbstractInputStreamJarback to summary
public AbstractInputStreamJar(URL jarFileUrl)

Method Detail

closeStreamback to summary
protected void closeStream()
createJarInputStreamback to summary
protected abstract NonClosingJarInputStream createJarInputStream() throws IOException
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
gotoEntryback to summary
private void gotoEntry(String name) throws IOException
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
populateMrMapback to summary
private void populateMrMap() throws IOException
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