A library for working with phylogenetic and population genetic data.
v0.27.0
GzipIStream Class Reference

#include <genesis/utils/io/gzip_stream.hpp>

Inherits istream.

Detailed Description

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:

  • GZip header, when stream starts with 1F 8B. See GZip format.
  • ZLib header, when stream starts with 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.

See also
GzipOStream
GzipIFStream
GzipOFStream

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 ()
 

Constructor & Destructor Documentation

◆ GzipIStream() [1/2]

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.

◆ GzipIStream() [2/2]

GzipIStream ( std::streambuf *  sbuf_p,
bool  auto_detect = true,
std::size_t  buffer_size = GZIP_DEFAULT_BUFFER_SIZE 
)
explicit

Definition at line 489 of file gzip_stream.cpp.

◆ ~GzipIStream()

~GzipIStream ( )
virtual

Definition at line 495 of file gzip_stream.cpp.


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