You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val fn ="bigfile.zip"val zipFile =ZipFile(fn)
val fh = zipFile.fileHeaders.firstOrNull()
fh?.let {
println(it.fileName)
val input = zipFile.getInputStream(it)
}
exception thrown at last line zipFile.getInputStream
I tracked it down through debugging, the exception is thrown at getCompressedSize:
java.lang.NullPointerException
at net.lingala.zip4j.io.inputstream.ZipInputStream.getCompressedSize(ZipInputStream.java:290)
at net.lingala.zip4j.io.inputstream.ZipInputStream.initializeEntryInputStream(ZipInputStream.java:199)
at net.lingala.zip4j.io.inputstream.ZipInputStream.getNextEntry(ZipInputStream.java:106)
at net.lingala.zip4j.util.UnzipUtil.createZipInputStream(UnzipUtil.java:29)
at net.lingala.zip4j.ZipFile.getInputStream(ZipFile.java:782)
but It's actually because the compressionMethod is null :
The root cause is because the compression code is 9 and it's not supported:
4.4.5 compression method: (2 bytes)
0 - The file is stored (no compression)
1 - The file is Shrunk
2 - The file is Reduced with compression factor 1
3 - The file is Reduced with compression factor 2
4 - The file is Reduced with compression factor 3
5 - The file is Reduced with compression factor 4
6 - The file is Imploded
7 - Reserved for Tokenizing compression algorithm
8 - The file is Deflated
9 - Enhanced Deflating using Deflate64(tm)
10 - PKWARE Data Compression Library Imploding (old IBM TERSE)
11 - Reserved by PKWARE
12 - File is compressed using BZIP2 algorithm
13 - Reserved by PKWARE
14 - LZMA
15 - Reserved by PKWARE
16 - IBM z/OS CMPSC Compression
17 - Reserved by PKWARE
18 - File is compressed using IBM TERSE (new)
19 - IBM LZ77 z Architecture (PFS)
96 - JPEG variant
97 - WavPack compressed data
98 - PPMd version I, Rev 1
99 - AE-x encryption marker (see APPENDIX E)
So instead of returning null, it should really throw an exception here...
The text was updated successfully, but these errors were encountered:
with the following code
exception thrown at last line
zipFile.getInputStream
I tracked it down through debugging, the exception is thrown at getCompressedSize:
but It's actually because the compressionMethod is null :
The root cause is because the compression code is 9 and it's not supported:
So instead of returning null, it should really throw an exception here...
The text was updated successfully, but these errors were encountered: