GZip file decompression
Copyright (c) 2004 John Goerzen, firstname.lastname@example.org
The GZip format is described in RFC1952.
The Header identifies the file as a GZip file, records the original modification date and time, and, in some cases, also records the original filename and comments.
The vast majority of GZip files contain only one Section. Standard tools that work with GZip files create single-section files by default.
Multi-section files can be created by simply concatenating two existing GZip files together. The standard gunzip and zcat tools will simply concatenate the decompressed data when reading these files back. The decompress function in this module will do the same.
When reading data from this module, please use caution regarding how you access it. For instance, if you are wanting to write the decompressed stream to disk and validate its CRC32 value, you could use the decompress function. However, you should process the entire stream before you check the value of the Bool it returns. Otherwise, you will force Haskell to buffer the entire file in memory just so it can check the CRC32.
|type Section = (Header, String, Footer)|
|A section represents a compressed component in a GZip file. Every GZip file has at least one.|
|decompress :: String -> (String, Maybe GZipError)|
Read a GZip file, decompressing all sections that are found.
Returns a decompresed data stream and Nothing, or an unreliable string and Just (error). If you get anything other than Nothing, the String returned should be discarded.
|read_sections :: String -> Either GZipError [Section]|
|Read all sections.|
|read_header :: String -> Either GZipError (Header, String)|
|Read the GZip header. Return (Header, Remainder).|
|read_section :: String -> Either GZipError (Section, String)|
|Read one section, returning (ThisSection, Remainder)|
|Produced by Haddock version 0.8|