The Conley-Morse Graphs Software
|
A simple wrapper for the bzip2 data compression to an output stream. More...
#include <bytecompr.h>
Public Member Functions | |
ByteCompressor (std::ostream &out) | |
The constructor of an output stream for storing binary data. More... | |
~ByteCompressor () | |
The destructor that ends the compression procedure and releases the internal memory buffers. More... | |
void | close () |
Ends the compression and writes the remaining data to the stream. More... | |
void | write (const char *buf, size_t n) |
Writes the given number of bytes to the compression stream. More... | |
Private Member Functions | |
void | compress (bool finishing) |
Compresses the input buffer and writes the resulting data to the output stream. More... | |
ByteCompressor (const ByteCompressor &) | |
ByteCompressor & | operator= (const ByteCompressor &) |
Private Attributes | |
bz_stream * | bzStream |
The bzip2 data stream information. More... | |
std::ostream & | outStream |
A reference to the output stream to which the data should be written. More... | |
char * | inBuffer |
An internal buffer for caching data for compression. More... | |
char * | outBuffer |
An internal buffer for caching compressed data. More... | |
size_t | bufSize |
The size of each of the internal buffers. More... | |
size_t | inPos |
The current position in the internal buffer for compression. More... | |
A simple wrapper for the bzip2 data compression to an output stream.
Definition at line 58 of file bytecompr.h.
|
inline |
|
inline |
|
private |
|
inline |
Ends the compression and writes the remaining data to the stream.
It also deletes the bzip2 compression structure.
Definition at line 224 of file bytecompr.h.
References bzStream, and compress().
Referenced by ~ByteCompressor().
|
inlineprivate |
|
private |
void ByteCompressor::write | ( | const char * | buf, |
size_t | n | ||
) |
Writes the given number of bytes to the compression stream.
Uses an internal buffer to avoid the inefficiency that comes from passing small portions of data to the bzip2 procedures.
Definition at line 210 of file bytecompr.h.
References bufSize, compress(), inBuffer, and inPos.
Referenced by compress().
|
private |
The size of each of the internal buffers.
Definition at line 93 of file bytecompr.h.
Referenced by ByteCompressor(), compress(), and write().
|
private |
The bzip2 data stream information.
Definition at line 80 of file bytecompr.h.
Referenced by ByteCompressor(), close(), compress(), and ~ByteCompressor().
|
private |
An internal buffer for caching data for compression.
Definition at line 87 of file bytecompr.h.
Referenced by ByteCompressor(), compress(), write(), and ~ByteCompressor().
|
private |
The current position in the internal buffer for compression.
Definition at line 96 of file bytecompr.h.
Referenced by ByteCompressor(), compress(), and write().
|
private |
An internal buffer for caching compressed data.
Definition at line 90 of file bytecompr.h.
Referenced by ByteCompressor(), compress(), and ~ByteCompressor().
|
private |
A reference to the output stream to which the data should be written.
Definition at line 84 of file bytecompr.h.
Referenced by compress().