Get the compression level from the header.
(data: &[u8])
| 81 | |
| 82 | /// Get the compression level from the header. |
| 83 | pub fn compression_level(data: &[u8]) -> Result<i32, CodecError> { |
| 84 | if data.len() < HEADER_SIZE { |
| 85 | return Err(CodecError::Truncated { |
| 86 | expected: HEADER_SIZE, |
| 87 | actual: data.len(), |
| 88 | }); |
| 89 | } |
| 90 | Ok(data[4] as i32) |
| 91 | } |
| 92 | |
| 93 | // --------------------------------------------------------------------------- |
| 94 | // Platform-specific compression / decompression |