Gzipped file stream buffer class. More...
#include <zfstream.h>
Public Member Functions | |
gzfilebuf * | attach (int fd, std::ios_base::openmode mode) |
Attach to already open gzipped file. More... | |
gzfilebuf * | attach (int fd, std::ios_base::openmode mode) |
Attach to already open gzipped file. More... | |
gzfilebuf * | attach (int file_descriptor, int io_mode) |
gzfilebuf * | attach (int file_descriptor, int io_mode) |
gzfilebuf * | close () |
gzfilebuf * | close () |
gzfilebuf * | close () |
Close gzipped file. More... | |
gzfilebuf * | close () |
Close gzipped file. More... | |
gzfilebuf () | |
gzfilebuf () | |
gzfilebuf () | |
gzfilebuf () | |
int | is_open () const |
int | is_open () const |
bool | is_open () const |
Check if file is open. More... | |
bool | is_open () const |
Check if file is open. More... | |
gzfilebuf * | open (const char *name, int io_mode) |
gzfilebuf * | open (const char *name, int io_mode) |
gzfilebuf * | open (const char *name, std::ios_base::openmode mode) |
Open gzipped file. More... | |
gzfilebuf * | open (const char *name, std::ios_base::openmode mode) |
Open gzipped file. More... | |
virtual streampos | seekoff (streamoff, ios::seek_dir, int) |
virtual streampos | seekoff (streamoff, ios::seek_dir, int) |
int | setcompression (int comp_level, int comp_strategy=Z_DEFAULT_STRATEGY) |
Set compression level and strategy on the fly. More... | |
int | setcompression (int comp_level, int comp_strategy=Z_DEFAULT_STRATEGY) |
Set compression level and strategy on the fly. More... | |
int | setcompressionlevel (int comp_level) |
int | setcompressionlevel (int comp_level) |
int | setcompressionstrategy (int comp_strategy) |
int | setcompressionstrategy (int comp_strategy) |
virtual int | sync () |
virtual int | sync () |
virtual | ~gzfilebuf () |
virtual | ~gzfilebuf () |
virtual | ~gzfilebuf () |
virtual | ~gzfilebuf () |
Protected Member Functions | |
bool | open_mode (std::ios_base::openmode mode, char *c_mode) const |
Convert ios open mode int to mode string used by zlib. More... | |
bool | open_mode (std::ios_base::openmode mode, char *c_mode) const |
Convert ios open mode int to mode string used by zlib. More... | |
virtual int | overflow (int=EOF) |
virtual int | overflow (int=EOF) |
virtual int_type | overflow (int_type c=traits_type::eof()) |
Write put area to gzipped file. More... | |
virtual int_type | overflow (int_type c=traits_type::eof()) |
Write put area to gzipped file. More... | |
virtual std::streambuf * | setbuf (char_type *p, std::streamsize n) |
Installs external stream buffer. More... | |
virtual std::streambuf * | setbuf (char_type *p, std::streamsize n) |
Installs external stream buffer. More... | |
virtual std::streamsize | showmanyc () |
Number of characters available in stream buffer. More... | |
virtual std::streamsize | showmanyc () |
Number of characters available in stream buffer. More... | |
virtual int | sync () |
Flush stream buffer to file. More... | |
virtual int | sync () |
Flush stream buffer to file. More... | |
virtual int | underflow () |
virtual int | underflow () |
virtual int_type | underflow () |
Fill get area from gzipped file. More... | |
virtual int_type | underflow () |
Fill get area from gzipped file. More... | |
Private Member Functions | |
void | disable_buffer () |
Destroy internal buffer. More... | |
void | disable_buffer () |
Destroy internal buffer. More... | |
void | enable_buffer () |
Allocate internal buffer. More... | |
void | enable_buffer () |
Allocate internal buffer. More... | |
int | fillbuf () |
int | fillbuf () |
int | flushbuf () |
int | flushbuf () |
Private Attributes | |
char_type * | buffer |
Stream buffer. More... | |
std::streamsize | buffer_size |
Stream buffer size. More... | |
gzFile | file |
std::ios_base::openmode | io_mode |
short | mode |
bool | own_buffer |
True if this object owns stream buffer. More... | |
bool | own_fd |
True if this object owns file descriptor. More... | |
short | own_file_descriptor |
Gzipped file stream buffer class.
This class implements basic_filebuf for gzipped files. It doesn't yet support seeking (allowed by zlib but slow/limited), putback and read/write access (tricky). Otherwise, it attempts to be a drop-in replacement for the standard file streambuf.
Definition at line 8 of file bloaty/third_party/zlib/contrib/iostream/zfstream.h.
gzfilebuf::gzfilebuf | ( | ) |
Definition at line 4 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
|
virtual |
Definition at line 10 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
gzfilebuf::gzfilebuf | ( | ) |
|
virtual |
gzfilebuf::gzfilebuf | ( | ) |
|
virtual |
gzfilebuf::gzfilebuf | ( | ) |
|
virtual |
Attach to already open gzipped file.
fd | File descriptor. |
mode | Open mode flags. |
this
on success, NULL on failure. Definition at line 79 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.cc.
Attach to already open gzipped file.
fd | File descriptor. |
mode | Open mode flags. |
this
on success, NULL on failure. Definition at line 60 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
gzfilebuf * gzfilebuf::close | ( | ) |
Definition at line 102 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
gzfilebuf* gzfilebuf::close | ( | ) |
gzfilebuf* gzfilebuf::close | ( | ) |
Close gzipped file.
this
on success, NULL on failure. gzfilebuf* gzfilebuf::close | ( | ) |
Close gzipped file.
this
on success, NULL on failure.
|
private |
Destroy internal buffer.
This function is safe to call multiple times. It will ensure that the internal buffer is deallocated if it exists. In any case, it will also reset the buffer pointers.
|
private |
Destroy internal buffer.
This function is safe to call multiple times. It will ensure that the internal buffer is deallocated if it exists. In any case, it will also reset the buffer pointers.
Definition at line 347 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.cc.
|
private |
Allocate internal buffer.
This function is safe to call multiple times. It will ensure that a proper internal buffer exists if it is required. If the buffer already exists or is external, the buffer pointers will be reset to their original state.
|
private |
Allocate internal buffer.
This function is safe to call multiple times. It will ensure that a proper internal buffer exists if it is required. If the buffer already exists or is external, the buffer pointers will be reset to their original state.
Definition at line 308 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.cc.
|
private |
|
private |
Definition at line 235 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
|
private |
Definition at line 218 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
|
private |
|
inline |
Definition at line 22 of file bloaty/third_party/zlib/contrib/iostream/zfstream.h.
|
inline |
Definition at line 22 of file zlib/contrib/iostream/zfstream.h.
|
inline |
Check if file is open.
Definition at line 57 of file zlib/contrib/iostream3/zfstream.h.
|
inline |
Check if file is open.
Definition at line 57 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.h.
Definition at line 18 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
Open gzipped file.
name | File name. |
mode | Open mode flags. |
this
on success, NULL on failure. Open gzipped file.
name | File name. |
mode | Open mode flags. |
this
on success, NULL on failure. Definition at line 51 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.cc.
|
protected |
Convert ios open mode int to mode string used by zlib.
Definition at line 131 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.cc.
|
protected |
Convert ios open mode int to mode string used by zlib.
Definition at line 173 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
|
protectedvirtual |
Write put area to gzipped file.
c | Extra character to add to buffer contents. |
This actually writes characters in stream buffer to gzipped file. With unbuffered output this is done one character at a time.
|
protectedvirtual |
Write put area to gzipped file.
c | Extra character to add to buffer contents. |
This actually writes characters in stream buffer to gzipped file. With unbuffered output this is done one character at a time.
Definition at line 214 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.cc.
|
virtual |
|
virtual |
Definition at line 129 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
|
protectedvirtual |
Installs external stream buffer.
p | Pointer to char buffer. |
n | Size of external buffer. |
this
on success, NULL on failure.Call setbuf(0,0) to enable unbuffered output.
Definition at line 266 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.cc.
|
protectedvirtual |
Installs external stream buffer.
p | Pointer to char buffer. |
n | Size of external buffer. |
this
on success, NULL on failure.Call setbuf(0,0) to enable unbuffered output.
int gzfilebuf::setcompression | ( | int | comp_level, |
int | comp_strategy = Z_DEFAULT_STRATEGY |
||
) |
Set compression level and strategy on the fly.
comp_level | Compression level (see zlib.h for allowed values) |
comp_strategy | Compression strategy (see zlib.h for allowed values) |
Unfortunately, these parameters cannot be modified separately, as the previous zfstream version assumed. Since the strategy is seldom changed, it can default and setcompression(level) then becomes like the old setcompressionlevel(level).
int gzfilebuf::setcompression | ( | int | comp_level, |
int | comp_strategy = Z_DEFAULT_STRATEGY |
||
) |
Set compression level and strategy on the fly.
comp_level | Compression level (see zlib.h for allowed values) |
comp_strategy | Compression strategy (see zlib.h for allowed values) |
Unfortunately, these parameters cannot be modified separately, as the previous zfstream version assumed. Since the strategy is seldom changed, it can default and setcompression(level) then becomes like the old setcompressionlevel(level).
Definition at line 43 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.cc.
Definition at line 116 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
Definition at line 122 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
|
protectedvirtual |
Number of characters available in stream buffer.
This indicates number of characters in get area of stream buffer. These characters can be read without accessing the gzipped file.
|
protectedvirtual |
Number of characters available in stream buffer.
This indicates number of characters in get area of stream buffer. These characters can be read without accessing the gzipped file.
Definition at line 169 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.cc.
|
virtual |
|
virtual |
Definition at line 206 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
|
protectedvirtual |
Flush stream buffer to file.
This calls underflow(EOF) to do the job.
|
protectedvirtual |
Flush stream buffer to file.
This calls underflow(EOF) to do the job.
|
protectedvirtual |
|
protectedvirtual |
Definition at line 135 of file bloaty/third_party/zlib/contrib/iostream/zfstream.cpp.
|
protectedvirtual |
Fill get area from gzipped file.
This actually reads characters from gzipped file to stream buffer. Always buffered.
|
protectedvirtual |
Fill get area from gzipped file.
This actually reads characters from gzipped file to stream buffer. Always buffered.
|
private |
Stream buffer.
For simplicity this remains allocated on the free store for the entire life span of the gzfilebuf object, unless replaced by setbuf.
Definition at line 207 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.h.
|
private |
Stream buffer size.
Defaults to system default buffer size (typically 8192 bytes). Modified by setbuf.
Definition at line 215 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.h.
|
private |
Underlying file pointer.
Definition at line 35 of file bloaty/third_party/zlib/contrib/iostream/zfstream.h.
|
private |
Mode in which file was opened.
Definition at line 191 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.h.
|
private |
Definition at line 36 of file bloaty/third_party/zlib/contrib/iostream/zfstream.h.
|
private |
True if this object owns stream buffer.
This makes the class responsible for deleting the buffer upon destruction.
Definition at line 223 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.h.
|
private |
True if this object owns file descriptor.
This makes the class responsible for closing the file upon destruction.
Definition at line 199 of file bloaty/third_party/zlib/contrib/iostream3/zfstream.h.
|
private |
Definition at line 37 of file bloaty/third_party/zlib/contrib/iostream/zfstream.h.