jigdo API
Gunzip Class Reference
Allows .gz files to be decompressed in memory on the fly as they are being downloaded. More...
#include <gunzip.hh>
Public Member Functions | |
Gunzip (IO *ioPtr) | |
virtual | ~Gunzip () |
void | inject (const byte *compressed, unsigned size) |
Called by you whenever new compressed data is available. | |
byte * | nextOut () const |
Return current output position, i.e. | |
unsigned | availOut () const |
Return nr of bytes left in output buffer. | |
void | setOut (byte *newNextOut, unsigned newAvailOut) |
Supply an output buffer to place decompressed data into. | |
Public Attributes | |
IOPtr | io |
Classes | |
class | IO |
The Gunzip object makes calls to the virtual functions of a class you derive from this. More... | |
class | IOPtr |
Pointer to an IO object, can be changed during the Gunzip object's lifetime. More... |
Detailed Description
Allows .gz files to be decompressed in memory on the fly as they are being downloaded.In contrast to a gzstream-style object where calls would be made to the object to obtain decompressed data, with Gunzip calls have to be made to "push" new gzipped data to the object once available, and the Gunzip object then makes further calls, passing decompressed data to an object of your choice.
Contains code to auto-detect .gz files: If the file starts with \x1f\x8b\x08, the data is passed to zlib to decompress. Otherwise, it is assumed that the file is not compressed and it is passed to the output IO object unmodified.
Can deal with >1 concatenated .gz files; in this case, simply outputs the concatenated uncompressed data.
Constructor & Destructor Documentation
Gunzip::~Gunzip | ( | ) | [virtual] |
Member Function Documentation
void Gunzip::inject | ( | const byte * | compressed, | |
unsigned | size | |||
) |
Called by you whenever new compressed data is available.
The contents of "compressed" need not be preserved after the call returns.
References _, Assert, debug, io, L, and Paranoid.
Referenced by decompressFile(), and testCase2().
byte * Gunzip::nextOut | ( | ) | const [inline] |
Return current output position, i.e.
pointer to address where next uncompressed byte will be put.
unsigned Gunzip::availOut | ( | ) | const [inline] |
Return nr of bytes left in output buffer.
void Gunzip::setOut | ( | byte * | newNextOut, | |
unsigned | newAvailOut | |||
) | [inline] |
Supply an output buffer to place decompressed data into.
This *must* be called from gunzip_needOut(), but can also be called at other times, e.g. from gunzip_data().
Member Data Documentation
Referenced by inject(), and Gunzip::IOPtr::set().
The documentation for this class was generated from the following files:
Generated on Tue Sep 23 14:27:42 2008 for jigdo by
