Understand Deflate (Method 8) block types
masterThe Deflate algorithm stores compressed data in blocks. Each block starts with a header that defines its type. When parsing or implementing Deflate, identify the block type using bits 1-2 of the header:
00 (0): Stored Block. Data is uncompressed and byte-aligned. The block contains a length word followed by its one's complement.01 (1): Fixed Huffman Codes. Uses a predefined set of Huffman codes for literals and distances.10 (2): Dynamic Huffman Codes. Uses custom Huffman codes defined within the block header.11 (3): Reserved. Encountering this should trigger an "Error in compressed data".
Additionally, Bit 0 of the header is the Last Block bit, which is set to 1 if the current block is the final one in the stream.