The Conley-Morse Graphs Software
|
A simple wrapper for the bzip2 data decompression from an input stream. More...
#include <bytecompr.h>
Public Member Functions | |
ByteDecompressor (std::istream &in) | |
The constructor of an input stream for retrieving binary data. More... | |
~ByteDecompressor () | |
The destructor that ends the decompression procedure and releases the internal memory buffers. More... | |
void | close () |
Ends the decompression and deletes the bzip2 structure. More... | |
void | read (char *buf, size_t n) |
Reads the given number of bytes from the decompressed stream. More... | |
Private Member Functions | |
void | decompress () |
Decompresses data from the input buffer (and the input stream) to provide more data for reading if possible. More... | |
ByteDecompressor (const ByteDecompressor &) | |
ByteDecompressor & | operator= (const ByteDecompressor &) |
Private Attributes | |
bz_stream * | bzStream |
The bzip2 data stream information. More... | |
std::istream & | inStream |
A reference to the input stream from which the compressed data should be read. More... | |
char * | inBuffer |
An internal buffer for caching data read from the input stream. More... | |
char * | outBuffer |
An internal buffer for caching decompressed data. More... | |
size_t | bufSize |
The size of each of the internal buffers. More... | |
bool | finished |
Is the decompression procedure completed? More... | |
size_t | inPos |
The current position in the internal buffer with compressed data. More... | |
size_t | inPosEnd |
The end of the compressed data in the internal buffer. More... | |
size_t | outPos |
The current position in the internal buffer with decompressed data. More... | |
size_t | outPosEnd |
The position of the end of the decompressed data in the internal buffer. More... | |
A simple wrapper for the bzip2 data decompression from an input stream.
Definition at line 294 of file bytecompr.h.
|
inline |
|
inline |
|
private |
|
inline |
Ends the decompression and deletes the bzip2 structure.
Definition at line 517 of file bytecompr.h.
References bzStream.
Referenced by ~ByteDecompressor().
|
inlineprivate |
|
private |
void ByteDecompressor::read | ( | char * | buf, |
size_t | n | ||
) |
Reads the given number of bytes from the decompressed stream.
Uses an internal buffer to avoid the inefficiency that comes from taking small portions of data from the bzip2 procedures. Throws an exception if there is not enough data.
Definition at line 503 of file bytecompr.h.
References bufSize, decompress(), outBuffer, outPos, and outPosEnd.
Referenced by decompress().
|
private |
The size of each of the internal buffers.
Definition at line 329 of file bytecompr.h.
Referenced by ByteDecompressor(), decompress(), and read().
|
private |
The bzip2 data stream information.
Definition at line 316 of file bytecompr.h.
Referenced by ByteDecompressor(), close(), decompress(), and ~ByteDecompressor().
|
private |
Is the decompression procedure completed?
Definition at line 332 of file bytecompr.h.
Referenced by ByteDecompressor(), and decompress().
|
private |
An internal buffer for caching data read from the input stream.
Definition at line 323 of file bytecompr.h.
Referenced by ByteDecompressor(), decompress(), and ~ByteDecompressor().
|
private |
The current position in the internal buffer with compressed data.
Definition at line 335 of file bytecompr.h.
Referenced by ByteDecompressor(), and decompress().
|
private |
The end of the compressed data in the internal buffer.
Definition at line 338 of file bytecompr.h.
Referenced by ByteDecompressor(), and decompress().
|
private |
A reference to the input stream from which the compressed data should be read.
Definition at line 320 of file bytecompr.h.
Referenced by decompress().
|
private |
An internal buffer for caching decompressed data.
Definition at line 326 of file bytecompr.h.
Referenced by ByteDecompressor(), decompress(), read(), and ~ByteDecompressor().
|
private |
The current position in the internal buffer with decompressed data.
Definition at line 342 of file bytecompr.h.
Referenced by ByteDecompressor(), decompress(), and read().
|
private |
The position of the end of the decompressed data in the internal buffer.
Definition at line 346 of file bytecompr.h.
Referenced by ByteDecompressor(), decompress(), and read().