Class JarFile
java.lang.Object
java.util.zip.ZipFile
java.util.jar.JarFile
org.springframework.boot.loader.jar.JarFile
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterable<JarEntry>
Extended variant of
JarFile
that behaves in the same way but
offers the following additional functionality.
- Since:
- 1.0.0
- Author:
- Phillip Webb, Andy Wilkinson
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final long
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final long
static final int
static final int
static final int
static final int
static final int
static final int
static final long
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final long
static final int
static final int
static final int
Fields inherited from class java.util.zip.ZipFile
OPEN_DELETE, OPEN_READ
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
close()
boolean
containsEntry
(String name) entries()
getInputStream
(ZipEntry entry) org.springframework.boot.loader.jar.JarEntry
getJarEntry
(CharSequence name) org.springframework.boot.loader.jar.JarEntry
getJarEntry
(String name) getName()
getNestedJarFile
(ZipEntry entry) Return a nestedJarFile
loaded from the specified entry.getNestedJarFile
(org.springframework.boot.loader.jar.JarEntry entry) Return a nestedJarFile
loaded from the specified entry.protected String
protected final RandomAccessDataFile
getUrl()
iterator()
Return an iterator for the contained entries.static void
Register a 'java.protocol.handler.pkgs' property so that aURLStreamHandler
will be located to deal with jar URLs.int
size()
stream()
toString()
Methods inherited from class java.util.jar.JarFile
baseVersion, getVersion, isMultiRelease, runtimeVersion, versionedStream
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
LOCSIG
static final long LOCSIG- See Also:
-
EXTSIG
static final long EXTSIG- See Also:
-
CENSIG
static final long CENSIG- See Also:
-
ENDSIG
static final long ENDSIG- See Also:
-
LOCHDR
static final int LOCHDR- See Also:
-
EXTHDR
static final int EXTHDR- See Also:
-
CENHDR
static final int CENHDR- See Also:
-
ENDHDR
static final int ENDHDR- See Also:
-
LOCVER
static final int LOCVER- See Also:
-
LOCFLG
static final int LOCFLG- See Also:
-
LOCHOW
static final int LOCHOW- See Also:
-
LOCTIM
static final int LOCTIM- See Also:
-
LOCCRC
static final int LOCCRC- See Also:
-
LOCSIZ
static final int LOCSIZ- See Also:
-
LOCLEN
static final int LOCLEN- See Also:
-
LOCNAM
static final int LOCNAM- See Also:
-
LOCEXT
static final int LOCEXT- See Also:
-
EXTCRC
static final int EXTCRC- See Also:
-
EXTSIZ
static final int EXTSIZ- See Also:
-
EXTLEN
static final int EXTLEN- See Also:
-
CENVEM
static final int CENVEM- See Also:
-
CENVER
static final int CENVER- See Also:
-
CENFLG
static final int CENFLG- See Also:
-
CENHOW
static final int CENHOW- See Also:
-
CENTIM
static final int CENTIM- See Also:
-
CENCRC
static final int CENCRC- See Also:
-
CENSIZ
static final int CENSIZ- See Also:
-
CENLEN
static final int CENLEN- See Also:
-
CENNAM
static final int CENNAM- See Also:
-
CENEXT
static final int CENEXT- See Also:
-
CENCOM
static final int CENCOM- See Also:
-
CENDSK
static final int CENDSK- See Also:
-
CENATT
static final int CENATT- See Also:
-
CENATX
static final int CENATX- See Also:
-
CENOFF
static final int CENOFF- See Also:
-
ENDSUB
static final int ENDSUB- See Also:
-
ENDTOT
static final int ENDTOT- See Also:
-
ENDSIZ
static final int ENDSIZ- See Also:
-
ENDOFF
static final int ENDOFF- See Also:
-
ENDCOM
static final int ENDCOM- See Also:
-
-
Constructor Details
-
JarFile
Create a newJarFile
backed by the specified file.- Parameters:
file
- the root jar file- Throws:
IOException
- if the file cannot be read
-
-
Method Details
-
getRootJarFile
-
getManifest
- Overrides:
getManifest
in classJarFile
- Throws:
IOException
-
entries
-
stream
-
iterator
Return an iterator for the contained entries. -
getJarEntry
-
getJarEntry
- Overrides:
getJarEntry
in classJarFile
-
containsEntry
-
getEntry
-
getInputStream
- Overrides:
getInputStream
in classJarFile
- Throws:
IOException
-
getNestedJarFile
Return a nestedJarFile
loaded from the specified entry.- Parameters:
entry
- the zip entry- Returns:
- a
JarFile
for the entry - Throws:
IOException
- if the nested jar file cannot be read
-
getNestedJarFile
public JarFile getNestedJarFile(org.springframework.boot.loader.jar.JarEntry entry) throws IOException Return a nestedJarFile
loaded from the specified entry.- Parameters:
entry
- the zip entry- Returns:
- a
JarFile
for the entry - Throws:
IOException
- if the nested jar file cannot be read
-
getComment
- Overrides:
getComment
in classZipFile
-
size
public int size() -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classZipFile
- Throws:
IOException
-
getUrl
- Throws:
MalformedURLException
-
toString
-
getName
-
clearCache
public void clearCache() -
getPathFromRoot
-
registerUrlProtocolHandler
public static void registerUrlProtocolHandler()Register a 'java.protocol.handler.pkgs' property so that aURLStreamHandler
will be located to deal with jar URLs.
-