Class JarFile
java.lang.Object
net.sourceforge.jnlp.util.JarFile
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LazyLoaded<Constructor<JarFile>> private final JarFileprivate static final intprivate static final booleanprivate final LazyLoaded<Object> private static final byte[]The ZIP specification requires that the zip header for all entries in a zip-compressed archive must start with a well known "PK" which is defined as hex x50 x4b x03 x04. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()private JarFilecreateDelegate(File file) entries()private voidverifyZipHeader(File file) Verify the header for the zip entry.
-
Field Details
-
JAVA9_OR_GREATER
private static final boolean JAVA9_OR_GREATER -
runtimeVersion
-
constructor
-
delegate
-
ZIP_ENTRY_HEADER_SIGNATURE
private static final byte[] ZIP_ENTRY_HEADER_SIGNATUREThe ZIP specification requires that the zip header for all entries in a zip-compressed archive must start with a well known "PK" which is defined as hex x50 x4b x03 x04.Note - this is not file-header, it is item-header.
Actually most of compressing formats have some n-bytes headers. Eg: http://www.gzip.org/zlib/rfc-gzip.html#header-trailer for ID1 and ID2 so in case that some differently compressed jars will come to play, this is the place where to fix it.
- See Also:
-
HEADER_LENGTH
private static final int HEADER_LENGTH
-
-
Constructor Details
-
JarFile
- Throws:
IOException
-
JarFile
- Throws:
IOException
-
-
Method Details
-
createDelegate
- Throws:
IOException
-
getManifest
- Throws:
IOException
-
entries
-
getInputStream
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getNative
-
verifyZipHeader
Verify the header for the zip entry.Although zip specification allows to skip all corrupted entries, it is not safe for jars since it allows a different format to fake itself as a Jar.
- Throws:
IOException
-