public class JarFileUrlJar extends Object implements Jar
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) .Constructor and Description |
---|
JarFileUrlJar(URL url,
boolean startsWithJar) |
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. |
URL |
getJarFileURL() |
long |
getLastModified(String name)
Obtain the last modified time for the given resource in the JAR.
|
Manifest |
getManifest()
Obtain the manifest for the JAR file.
|
String |
getURL(String entry)
Obtain, in String form, the URL for an entry in this 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.
|
public JarFileUrlJar(URL url, boolean startsWithJar) throws IOException
IOException
public URL getJarFileURL()
getJarFileURL
in interface Jar
public boolean entryExists(String name)
Jar
entryExists
in interface Jar
name
- Entry to look fortrue
if the specified entry exists else
false
public InputStream getInputStream(String name) throws IOException
Jar
InputStream
for a given entry in a JAR. The caller is
responsible for closing the stream.getInputStream
in interface Jar
name
- Entry to obtain an InputStream
forInputStream
for the specified entry or null if
the entry does not existIOException
- if an I/O error occurs while processing the JAR filepublic long getLastModified(String name) throws IOException
Jar
getLastModified
in interface Jar
name
- Entry to obtain the modification time forSystem.currentTimeMillis()
that the resource was last
modified. Returns -1 if the entry does not existIOException
- if an I/O error occurs while processing the JAR filepublic String getURL(String entry)
Jar
JarFactory
to ensure resources are
accessed correctly.public void close()
Jar
close
in interface AutoCloseable
close
in interface Jar
public void nextEntry()
Jar
public String getEntryName()
Jar
getEntryName
in interface Jar
public InputStream getEntryInputStream() throws IOException
Jar
getEntryInputStream
in interface Jar
IOException
- If the stream cannot be obtainedpublic Manifest getManifest() throws IOException
Jar
getManifest
in interface Jar
IOException
- If an I/O error occurs trying to obtain the manifestpublic void reset() throws IOException
Jar
reset
in interface Jar
IOException
- If the pointer cannot be resetCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.