AvogadroLibs 2.1.0-20261111
Loading...
Searching...
No Matches
CompressingStreamBuf Class Reference

A stream buffer that compresses into another stream. More...

#include <compressedstream.h>

Inheritance diagram for CompressingStreamBuf:

Public Member Functions

 CompressingStreamBuf (std::unique_ptr< std::ostream > sink, Compression type)
 Compress everything written here into sink.
 CompressingStreamBuf (const CompressingStreamBuf &)=delete
CompressingStreamBuf & operator= (const CompressingStreamBuf &)=delete
bool finish ()
 Flush the codec and write the trailer.
std::string error () const

Protected Member Functions

int_type overflow (int_type ch=traits_type::eof()) override
std::streamsize xsputn (const char *s, std::streamsize count) override
int sync () override

Detailed Description

<avogadro/io/compressedstream.h>

Constructor & Destructor Documentation

◆ CompressingStreamBuf()

CompressingStreamBuf ( std::unique_ptr< std::ostream > sink,
Compression type )
Parameters
sinkThe stream to write compressed bytes to. Ownership is taken.
typeThe codec to encode with, which must not be Compression::None.

Member Function Documentation

◆ finish()

bool finish ( )

Must happen before the sink is closed or the output is unreadable, so the destructor calls this too. Calling it twice is harmless.

Returns
True if the stream was finished cleanly.

◆ error()

std::string error ( ) const
Returns
The error encountered while encoding, empty if none.

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