public interface IJarFile extends Closeable
Modifier and Type | Field and Description |
---|---|
static String |
MANIFEST_ENTRY
The name of the manifest entry in the Jar file.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the Jar file.
|
Enumeration<JarEntry> |
entries()
Returns an enumeration of the Jar file entries.
|
ZipEntry |
getEntry(String name)
Returns the zip file entry for the specified name, or null
if not found.
|
byte[] |
getEntryData(String name)
Gets the byte [] data for an entry if present.
|
byte[] |
getEntryData(ZipEntry ze)
Gets the byte [] data for an entry if present.
|
URLStreamHandler |
getHandler()
Gets the URL stream handler.
|
InputStream |
getInputStream(ZipEntry ze)
Returns an input stream for reading the contents of the specified
Zip/Jar file entry.
|
JarEntry[] |
getJarEntries()
Gets all Jar entries if the Jar file is loaded into memory.
|
JarEntry |
getJarEntry(String name)
Returns the
JarEntry for the given entry name or
null if not found. |
File |
getJarFile()
Gets the file of the Jar file.
|
default JarEntry |
getJarManifestEntry()
Returns the Jar file manifest entry, or
null for none. |
Manifest |
getManifest()
Returns the Jar file manifest, or
null if none. |
String |
getName()
Returns the path name of the Zip/Jar file.
|
URL |
getURL()
Gets the MemoryJar URL to be used with e.g.
|
URL |
getURL(String path)
Gets the MemoryJar URL to be used with e.g.
|
URL |
getURL(ZipEntry entry)
Gets the MemoryJar URL to be used with e.g.
|
default boolean |
hasChanged()
Checks if the Jar file has changed since last call to this method,
i.e.
|
long |
lastModified()
Returns the time that the file denoted by this abstract pathname was
last modified.
|
Stream<JarEntry> |
stream()
Returns a stream of Jar entries.
|
static final String MANIFEST_ENTRY
String getName()
File getJarFile()
File
used to load the Jar file,
or null
for a memory Jar as there is no
valid File
representation for it.long lastModified()
If it's a memory Jar file, this is provided when creating the memory Jar file.
Where it is required to distinguish an I/O exception from the case
where 0L
is returned, or where several attributes of the
same file are required at the same time, or where the time of last
access or the creation time are required, then the Files.readAttributes
method may be used.
long
value representing the time the file was
last modified, measured in milliseconds since the epoch
(00:00:00 GMT, January 1, 1970), or 0L
if the
file does not exist or if an I/O error occursSecurityException
- If a security manager exists and its SecurityManager.checkRead(java.lang.String)
method denies read access to the filedefault boolean hasChanged()
default JarEntry getJarManifestEntry() throws IOException
null
for none.null
for none.IllegalStateException
- May be thrown if the Jar file has been closed.IOException
- If an I/O error has occurred.Manifest getManifest() throws IOException
null
if none.null
if none.IllegalStateException
- May be thrown if the Jar file has been closed.IOException
- If an I/O error has occurred.Enumeration<JarEntry> entries()
Stream<JarEntry> stream()
ZipEntry getEntry(String name)
name
- The name of the entry.IllegalStateException
- If the Zip file has been closed.JarEntry getJarEntry(String name)
JarEntry
for the given entry name or
null
if not found.name
- The Jar file entry name.JarEntry
for the given entry name or
null
if not found.IllegalStateException
- May be thrown if the Jar file has been closed.JarEntry
InputStream getInputStream(ZipEntry ze) throws IOException
ze
- The Zip or Jar file entry.ZipException
- If a Zip/Jar file format error has occurred.IOException
- If an I/O error has occurred.SecurityException
- If any of the Jar file entries are incorrectly signed.IllegalStateException
- May be thrown if the Jar file has been closed.URL getURL()
URL getURL(ZipEntry entry)
entry
- The Jar entry.URL getURL(String path)
path
- A path specification.URLStreamHandler getHandler()
byte[] getEntryData(String name)
name
- the name of the entry.byte[] getEntryData(ZipEntry ze)
ze
- the name of the entry.JarEntry[] getJarEntries()
void close() throws IOException
Closing this Jar file will close all of the input streams
previously returned by invocations of the getInputStream
method.
close
in interface AutoCloseable
close
in interface Closeable
IOException
- if an I/O error has occurred.Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.