zipios++
2.0.2
Zipios++ – a small C++ library that provides easy access to .zip files.
|
A stream buffer to inflate data previous compressed with zlib. More...
#include <inflateinputstreambuf.hpp>
Public Member Functions | |
InflateInputStreambuf (std::streambuf *inbuf, offset_t s_pos=-1) | |
Initialize a InflateInputStreambuf. More... | |
InflateInputStreambuf (InflateInputStreambuf const &src)=delete | |
virtual | ~InflateInputStreambuf () |
Clean up the InflateInputStreambuf object. More... | |
InflateInputStreambuf & | operator= (InflateInputStreambuf const &src)=delete |
bool | reset (offset_t stream_position=-1) |
Initializes the stream buffer. More... | |
Protected Member Functions | |
virtual std::streambuf::int_type | underflow () override |
Called when more data is required. More... | |
Protected Attributes | |
std::streambuf * | m_inbuf |
std::vector< char > | m_outvec |
Private Attributes | |
std::vector< char > | m_invec |
z_stream | m_zs |
bool | m_zs_initialized = false |
The InflateInputStreambuf class is an input stream filter, that inflates the input from the attached input stream.
Deflation/Inflation is a compression/decompression method used in gzip and zip. The zlib library is used to perform the actual inflation, this class only wraps the functionality in an input stream filter.
Definition at line 47 of file inflateinputstreambuf.hpp.
zipios::InflateInputStreambuf::InflateInputStreambuf | ( | std::streambuf * | inbuf, |
offset_t | start_pos = -1 |
||
) |
The constructor initializes the various stream buffers and setup the stream start position using the start_pos
parameter.
Data will be inflated (decompressed using zlib) before being returned.
[in,out] | inbuf | The streambuf to use for input. |
[in] | start_pos | A position to reset the inbuf to before reading. Specify -1 to not change the position. |
Definition at line 70 of file inflateinputstreambuf.cpp.
|
delete |
|
virtual |
The destructor makes sure all allocated resources get cleaned up.
Definition at line 99 of file inflateinputstreambuf.cpp.
References m_zs.
|
delete |
bool zipios::InflateInputStreambuf::reset | ( | offset_t | stream_position = -1 | ) |
This function resets the zlib stream and purges input and output buffers. It also repositions the input streambuf at stream_position.
[in] | stream_position | A position to reset the inbuf to before reading. Specify -1 to read from the current position. |
Definition at line 215 of file inflateinputstreambuf.cpp.
References zipios::getBufferSize(), zipios::FilterInputStreambuf::m_inbuf, m_invec, m_outvec, m_zs, and m_zs_initialized.
Referenced by InflateInputStreambuf(), and zipios::ZipInputStreambuf::ZipInputStreambuf().
|
overrideprotectedvirtual |
The function ensures that at least one byte is available in the input area by updating the pointers to the input area and reading more data in from the input sequence if required.
This function actually passes the data through the zlib library to decompress it.
Reimplemented in zipios::ZipInputStreambuf.
Definition at line 130 of file inflateinputstreambuf.cpp.
References zipios::getBufferSize(), zipios::FilterInputStreambuf::m_inbuf, m_invec, m_outvec, and m_zs.
Referenced by zipios::ZipInputStreambuf::underflow().
|
protectedinherited |
Definition at line 46 of file filterinputstreambuf.hpp.
Referenced by zipios::FilterInputStreambuf::FilterInputStreambuf(), reset(), zipios::ZipInputStreambuf::underflow(), underflow(), and zipios::ZipInputStreambuf::ZipInputStreambuf().
|
private |
Definition at line 65 of file inflateinputstreambuf.hpp.
Referenced by reset(), and underflow().
|
protected |
Definition at line 62 of file inflateinputstreambuf.hpp.
Referenced by reset(), zipios::ZipInputStreambuf::underflow(), underflow(), and zipios::ZipInputStreambuf::ZipInputStreambuf().
|
private |
Definition at line 67 of file inflateinputstreambuf.hpp.
Referenced by InflateInputStreambuf(), reset(), underflow(), and ~InflateInputStreambuf().
|
private |
Definition at line 68 of file inflateinputstreambuf.hpp.
Referenced by reset().