ZBuffer Class Reference

#include <Pt/ZBuffer.h>

Stream buffer for zlib compression.

Inherits BasicStreamBuffer< char >.

Public Types

enum  Format {
  Zlib = 0,
  Gzip
}
 Compression/decompression format. More...
 

Public Member Functions

 ZBuffer (Format fmt=Zlib)
 Default Constructor.
 
 ZBuffer (std::ios &ios, Format fmt=Zlib)
 Construct with target stream.
 
virtual ~ZBuffer ()
 Destructor.
 
void attach (std::ios &target)
 Attach to target stream.
 
void detach ()
 Detach from target stream.
 
void discard ()
 Discards the buffer content and resets the state.
 
void reset ()
 Detach from target stream, discard the buffer and reset the state.
 
void reset (std::ios &target)
 Attach to target stream, discard the buffer and reset the state.
 
void finish ()
 Finish and flush remaining data to the target stream.
 
std::size_t zcount () const
 Returns the total number of decompressed bytes produced so far.
 
std::streamsize import (std::streamsize maxImport=0)
 Import data from the target stream. More...
 
std::streamsize speekn (char *buffer, std::streamsize size)
 Peek data in stream.
 
std::streamsize out_avail ()
 Returns the number of characters buffered for output.
 

Protected Member Functions

virtual std::streamsize showfull ()
 Returns the number of characters buffered for output.
 

Member Enumeration Documentation

◆ Format

enum Format
Enumerator
Zlib 

zlib header/trailer with Adler-32 checksum.

Gzip 

gzip header/trailer with CRC-32 checksum (RFC 1952).

Member Function Documentation

◆ import()

std::streamsize import ( std::streamsize  maxImport = 0)

Returns the number of bytes consumed from the underlyig stream.