Does zlib allow unpacking from the middle of the file?I mean, if I call inflate with a stream that points to the middle of the compressed data, without calling inflate for the data preceding the middle, will this work?
inflate
Copy from zlib FAQ (emphasis mine):
28. Can I accidentally get data in a compressed stream?No, not without any preparation. If during compression you periodically use Z_FULL_FLUSH , carefully write all the pending data at these points and save the index of these locations, then you can start decompression at these points. You must be careful not to use Z_FULL_FLUSH too often, as this can significantly degrade compression. In addition, you can scan the deflation flow once to create an index, and then use this index for random access. See Examples /zran.c.
28. Can I accidentally get data in a compressed stream?
No, not without any preparation. If during compression you periodically use Z_FULL_FLUSH , carefully write all the pending data at these points and save the index of these locations, then you can start decompression at these points. You must be careful not to use Z_FULL_FLUSH too often, as this can significantly degrade compression. In addition, you can scan the deflation flow once to create an index, and then use this index for random access. See Examples /zran.c.
Z_FULL_FLUSH
Source: https://habr.com/ru/post/888984/More articles:Getting the full C # tag URL - phpHow to convert List to byte [] in C #? - listGWT Celltable only displays 15 rows - javaAnt: copy the same set of files to several places - continued - copyHow to show full message when clicking on message tag in asp.net? - asp.netString.xml provides me with an invalid string for ProcessDialog - androidC # Inheritance Issues - inheritanceHurst Index Calculation - mathWPF: Managing a text editor that can reorder paragraphs by dragging and dropping (for example, OneNote) - text-editorGoogle Analytics Client Filter: "Compatible with Mozilla Agent / iPhone" - regexAll Articles