While reading a ZIP file, can we safely assume that all file structures (by that I mean Local File Header + file data (compressed or stored) + Data Descriptor) are exactly consecutive? Can there be any irrelevant data in between?

有帮助吗?

解决方案

PkWare Appnote tells that

"Immediately following the local header for a file is the compressed or stored data for the file. The series of [local file header][file data][data descriptor] repeats for each file in the .ZIP archive."

So there should be no gaps between them.

However, I would recommend to parse and read central directory, not go through local file headers (except that you need streamed processing).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top