An input stream buffer that decompresses data as it is read.
More...
#include <utilities/zstream.h>
|
| DecompressionBuffer () |
| Creates a new decompression stream buffer. More...
|
|
| DecompressionBuffer (const char *path) |
| Creates a new decompression stream buffer that reads from the given file. More...
|
|
int | open (const char *path) |
| Opens the given file for decompressed reading. More...
|
|
virtual int | overflow (int c) |
| Writes the given character to the underlying file, compressing en route. More...
|
|
virtual int | underflow () |
| Reads the next character from the underlying file, decompressing en route. More...
|
|
virtual int | uflow () |
| Reads the next character from the underlying file, decompressing en route. More...
|
|
virtual std::streamsize | xsputn (const char *s, std::streamsize n) |
| Writes the given set of characters to the underlying file, compressing en route. More...
|
|
virtual std::streamsize | xsgetn (char *s, std::streamsize n) |
| Reads a set of characters from the underlying file, decompressing en route. More...
|
|
virtual int | pbackfail (int c) |
| Pushes the given character back into the underlying input stream. More...
|
|
virtual int | sync () |
| Flushes all input/output buffers. More...
|
|
int | close () |
| Closes the underlying file. More...
|
|
void | showError (std::ostream &out) |
| Writes a description of the last (de)compression error that occurred. More...
|
|
|
static const int | zEOF |
| The end-of-file marker used with this stream buffer. More...
|
|
|
int | open (const char *path, const char *mode) |
| Opens the given file for (de)compressed reading or writing. More...
|
|
An input stream buffer that decompresses data as it is read.
The standard zlib compression library is used.
This buffer is designed for use with standard C++ I/O streams.
This stream buffer should not be used for output.
- Python:
- Not present.
regina::DecompressionBuffer::DecompressionBuffer |
( |
| ) |
|
|
inline |
Creates a new decompression stream buffer.
regina::DecompressionBuffer::DecompressionBuffer |
( |
const char * |
path | ) |
|
|
inline |
Creates a new decompression stream buffer that reads from the given file.
The underlying file will be opened automatically.
- Internationalisation:
- This routine makes no assumptions about the character encoding used in the given file name, and simply passes it through unchanged to low-level C/C++ file I/O routines.
- Parameters
-
path | the pathname of the new file to open. |
int regina::ZBuffer::close |
( |
| ) |
|
|
inherited |
Closes the underlying file.
If no file is open, this routine does nothing.
- Returns
- 0 on success, or zEOF on error.
int regina::ZBuffer::open |
( |
const char * |
path, |
|
|
const char * |
mode |
|
) |
| |
|
protectedinherited |
Opens the given file for (de)compressed reading or writing.
If a file is already open, it will be closed before the new file is opened.
- Internationalisation:
- This routine makes no assumptions about the character encoding used in the given file name, and simply passes it through unchanged to low-level C/C++ file I/O routines.
- Parameters
-
path | the pathname of the new file to open. |
mode | the mode in which to open the file; this must be "rb" for reading or "wb" for writing. |
- Returns
- 0 on success, or zEOF on error.
int regina::DecompressionBuffer::open |
( |
const char * |
path | ) |
|
|
inline |
Opens the given file for decompressed reading.
If a file is already open, it will be closed before the new file is opened.
- Internationalisation:
- This routine makes no assumptions about the character encoding used in the given file name, and simply passes it through unchanged to low-level C/C++ file I/O routines.
- Parameters
-
path | the pathname of the new file to open. |
- Returns
- 0 on success, or zEOF on error.
int regina::ZBuffer::overflow |
( |
int |
c | ) |
|
|
inlinevirtualinherited |
Writes the given character to the underlying file, compressing en route.
- Parameters
-
c | the uncompressed character to write. |
- Returns
- the given character on success, or zEOF on error.
int regina::ZBuffer::pbackfail |
( |
int |
c | ) |
|
|
inlinevirtualinherited |
Pushes the given character back into the underlying input stream.
- Warning
- This routine will only succeed if the next character in the underlying input stream has not already been read.
- Parameters
-
c | the character to push back. |
- Returns
- the character that was pushed back, or zEOF if an error occurred.
void regina::ZBuffer::showError |
( |
std::ostream & |
out | ) |
|
|
inherited |
Writes a description of the last (de)compression error that occurred.
For the message to be meaningful, the underlying file must still be open.
- Parameters
-
out | the output stream to which the error description should be written. |
int regina::ZBuffer::sync |
( |
| ) |
|
|
inlinevirtualinherited |
Flushes all input/output buffers.
- Returns
- 0 on success, or zEOF on error.
int regina::ZBuffer::uflow |
( |
| ) |
|
|
inlinevirtualinherited |
Reads the next character from the underlying file, decompressing en route.
The character is consumed.
- Returns
- the next uncompressed character, or zEOF if there is an error or there are no more characters.
int regina::ZBuffer::underflow |
( |
| ) |
|
|
inlinevirtualinherited |
Reads the next character from the underlying file, decompressing en route.
The character is not consumed.
- Returns
- the next uncompressed character, or zEOF if there is an error or there are no more characters.
virtual std::streamsize regina::ZBuffer::xsgetn |
( |
char * |
s, |
|
|
std::streamsize |
n |
|
) |
| |
|
virtualinherited |
Reads a set of characters from the underlying file, decompressing en route.
The characters are all consumed. Reading will stop if end-of-file is reached or an error occurs.
- Parameters
-
s | the array into which the uncompressed characters should be placed. |
n | the number of uncompressed characters to read. |
- Returns
- the number of uncompressed characters that were actually read, or zEOF if an error occurred.
std::streamsize regina::ZBuffer::xsputn |
( |
const char * |
s, |
|
|
std::streamsize |
n |
|
) |
| |
|
inlinevirtualinherited |
Writes the given set of characters to the underlying file, compressing en route.
- Parameters
-
s | the uncompressed array of characters to write. |
n | the number of characters to write. |
- Returns
- the number of uncompressed characters that were actually written, or 0 if an error occurred.
const int regina::ZBuffer::zEOF |
|
staticinherited |
The end-of-file marker used with this stream buffer.
The documentation for this class was generated from the following file: