#include <genesis/utils/io/gzip_stream.hpp>
Inherits istream.
Input stream that offers on-the-fly gzip-decompression if needed.
The class accesses an external std::streambuf. It can be constructed from an existing std::istream (such as std::cin) or std::streambuf.
If auto_detect
is true
(default), the class seamlessly auto-detects whether the source stream is compressed or not. The following compressed streams are detected:
1F 8B
. See GZip format.78 01
, 78 9C
, or 78 DA
. See answer here.If none of these formats are detected, the class assumes the input is not compressed, and it produces a plain copy of the source stream.
The class is based on the zstr::istream class of the excellent zstr library by Matei David; see also our Acknowledgements.
If genesis is compiled without zlib support, constructing an instance of this class will throw an exception.
Definition at line 148 of file gzip_stream.hpp.
Public Member Functions | |
GzipIStream (std::istream &is, bool auto_detect=true, std::size_t buffer_size=GZIP_DEFAULT_BUFFER_SIZE) | |
GzipIStream (std::streambuf *sbuf_p, bool auto_detect=true, std::size_t buffer_size=GZIP_DEFAULT_BUFFER_SIZE) | |
virtual | ~GzipIStream () |
GzipIStream | ( | std::istream & | is, |
bool | auto_detect = true , |
||
std::size_t | buffer_size = GZIP_DEFAULT_BUFFER_SIZE |
||
) |
Definition at line 483 of file gzip_stream.cpp.
|
explicit |
Definition at line 489 of file gzip_stream.cpp.
|
virtual |
Definition at line 495 of file gzip_stream.cpp.