zipios++  2.0.2
Zipios++ – a small C++ library that provides easy access to .zip files.
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
zipios::ZipInputStreambuf Class Reference

An input stream buffer for Zip data. More...

#include <zipinputstreambuf.hpp>

Inheritance diagram for zipios::ZipInputStreambuf:
Inheritance graph
Collaboration diagram for zipios::ZipInputStreambuf:
Collaboration graph

Public Member Functions

 ZipInputStreambuf (std::streambuf *inbuf, offset_t start_pos=-1)
 Initialize a ZipInputStreambuf. More...
 ZipInputStreambuf (ZipInputStreambuf const &src)=delete
 The copy contructor is deleted. More...
virtual ~ZipInputStreambuf () override
 Clean up a ZipInputStreambuf object. More...
ZipInputStreambufoperator= (ZipInputStreambuf const &rhs)=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

ZipLocalEntry m_current_entry
offset_t m_remain = 0

Detailed Description

The ZipInputStreambuf class is a Zip input streambuf filter that automatically decompresses input data that was compressed using the zlib library.

Definition at line 42 of file zipinputstreambuf.hpp.

Constructor & Destructor Documentation

zipios::ZipInputStreambuf::ZipInputStreambuf ( std::streambuf *  inbuf,
offset_t  start_pos = -1 

This ZipInputStreambuf constructor initializes the buffer from the user specified buffer.

[in,out]inbufThe streambuf to use for input.
[in]start_posA position to reset the inbuf to before reading. Specify -1 to read from the current position.

Definition at line 55 of file zipinputstreambuf.cpp.

References zipios::DEFLATED, zipios::getBufferSize(), zipios::FileEntry::getMethod(), zipios::FileEntry::getSize(), zipios::ZipLocalEntry::hasTrailingDataDescriptor(), zipios::FileEntry::isValid(), m_current_entry, zipios::FilterInputStreambuf::m_inbuf, zipios::InflateInputStreambuf::m_outvec, m_remain, zipios::ZipLocalEntry::read(), zipios::InflateInputStreambuf::reset(), and zipios::STORED.

zipios::ZipInputStreambuf::ZipInputStreambuf ( ZipInputStreambuf const &  src)

ZipInputStreambuf objects cannot be copied so the copy constructor is deleted.

[in]srcThe source to copy.
zipios::ZipInputStreambuf::~ZipInputStreambuf ( )

The destructor ensures that all resources get released.

Definition at line 108 of file zipinputstreambuf.cpp.

Member Function Documentation

ZipInputStreambuf& zipios::ZipInputStreambuf::operator= ( ZipInputStreambuf const &  rhs)
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.

This method is called in the constructor, so it must not read anything from the input streambuf m_inbuf (see notice in constructor.)
[in]stream_positionA position to reset the inbuf to before reading. Specify -1 to read from the current position.
See Also

Definition at line 215 of file inflateinputstreambuf.cpp.

References zipios::getBufferSize(), zipios::FilterInputStreambuf::m_inbuf, zipios::InflateInputStreambuf::m_invec, zipios::InflateInputStreambuf::m_outvec, zipios::InflateInputStreambuf::m_zs, and zipios::InflateInputStreambuf::m_zs_initialized.

Referenced by zipios::InflateInputStreambuf::InflateInputStreambuf(), and ZipInputStreambuf().

std::streambuf::int_type zipios::ZipInputStreambuf::underflow ( )

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.

The value of that character on success or std::streambuf::traits_type::eof() on failure.

Reimplemented from zipios::InflateInputStreambuf.

Definition at line 122 of file zipinputstreambuf.cpp.

References zipios::DEFLATED, zipios::getBufferSize(), zipios::FileEntry::getMethod(), m_current_entry, zipios::FilterInputStreambuf::m_inbuf, zipios::InflateInputStreambuf::m_outvec, m_remain, zipios::STORED, and zipios::InflateInputStreambuf::underflow().

Member Data Documentation

ZipLocalEntry zipios::ZipInputStreambuf::m_current_entry

Definition at line 54 of file zipinputstreambuf.hpp.

Referenced by underflow(), and ZipInputStreambuf().

std::streambuf* zipios::FilterInputStreambuf::m_inbuf
std::vector<char> zipios::InflateInputStreambuf::m_outvec
offset_t zipios::ZipInputStreambuf::m_remain = 0

Definition at line 55 of file zipinputstreambuf.hpp.

Referenced by underflow(), and ZipInputStreambuf().

The documentation for this class was generated from the following files: