Library: Foundation
Package: Streams
Header: Poco/DeflatingStream.h
This is the streambuf class used by DeflatingInputStream and DeflatingOutputStream. The actual work is delegated to zlib (see http://zlib.net). Both zlib (deflate) streams and gzip streams are supported. Output streams should always call close() to ensure proper completion of compression. A compression level (0 to 9) can be specified in the constructor.
Direct Base Classes: BufferedStreamBuf
All Base Classes: BufferedStreamBuf
Member Functions: close, readFromDevice, sync, writeToDevice
Create a zlib header, use Adler-32 checksum.
Create a gzip header, use CRC-32 checksum.
DeflatingStreamBuf(
std::istream & istr,
StreamType type,
int level
);
Creates a DeflatingStreamBuf for compressing data read from the given input stream.
DeflatingStreamBuf(
std::istream & istr,
int windowBits,
int level
);
Creates a DeflatingStreamBuf for compressing data read from the given input stream.
Please refer to the zlib documentation of deflateInit2() for a description of the windowBits parameter.
DeflatingStreamBuf(
std::ostream & ostr,
StreamType type,
int level
);
Creates a DeflatingStreamBuf for compressing data passed through and forwarding it to the given output stream.
DeflatingStreamBuf(
std::ostream & ostr,
int windowBits,
int level
);
Creates a DeflatingStreamBuf for compressing data passed through and forwarding it to the given output stream.
Please refer to the zlib documentation of deflateInit2() for a description of the windowBits parameter.
Destroys the DeflatingStreamBuf.
int close();
Finishes up the stream.
Must be called when deflating to an output stream.
int readFromDevice(
char * buffer,
std::streamsize length
);
virtual int sync();
int writeToDevice(
const char * buffer,
std::streamsize length
);