QuaZIP quazip-0-6-2
|
GZIP file. More...
#include <quagzipfile.h>
Public Member Functions | |
QuaGzipFile () | |
Empty constructor. | |
QuaGzipFile (QObject *parent) | |
Empty constructor with a parent. | |
QuaGzipFile (const QString &fileName, QObject *parent=NULL) | |
Constructor. | |
virtual | ~QuaGzipFile () |
Destructor. | |
void | setFileName (const QString &fileName) |
Sets the name of the GZIP file to be opened. | |
QString | getFileName () const |
Returns the name of the GZIP file. | |
virtual bool | isSequential () const |
Returns true. | |
virtual bool | open (QIODevice::OpenMode mode) |
Opens the file. | |
virtual bool | open (int fd, QIODevice::OpenMode mode) |
Opens the file. | |
virtual bool | flush () |
Flushes data to file. | |
virtual void | close () |
Closes the file. | |
Protected Member Functions | |
virtual qint64 | readData (char *data, qint64 maxSize) |
Implementation of QIODevice::readData(). | |
virtual qint64 | writeData (const char *data, qint64 maxSize) |
Implementation of QIODevice::writeData(). |
GZIP file.
This class is a wrapper around GZIP file access functions in zlib. Unlike QuaZip classes, it doesn't allow reading from a GZIP file opened as QIODevice, for example, if your GZIP file is in QBuffer. It only provides QIODevice access to a GZIP file contents, but the GZIP file itself must be identified by its name on disk or by descriptor id.
QuaGzipFile::QuaGzipFile | ( | ) |
Empty constructor.
Must call setFileName() before trying to open.
QuaGzipFile::QuaGzipFile | ( | QObject * | parent | ) |
Empty constructor with a parent.
Must call setFileName() before trying to open.
parent | The parent object, as per QObject logic. |
QuaGzipFile::QuaGzipFile | ( | const QString & | fileName, |
QObject * | parent = NULL |
||
) |
Constructor.
fileName | The name of the GZIP file. |
parent | The parent object, as per QObject logic. |
bool QuaGzipFile::isSequential | ( | ) | const [virtual] |
Returns true.
Strictly speaking, zlib supports seeking for GZIP files, but it is poorly implemented, because there is no way to implement it properly. For reading, seeking backwards is very slow, and for writing, it is downright impossible. Therefore, QuaGzipFile does not support seeking at all.
bool QuaGzipFile::open | ( | QIODevice::OpenMode | mode | ) | [virtual] |
Opens the file.
mode | Can be either QIODevice::Write or QIODevice::Read. ReadWrite and Append aren't supported. |
Referenced by open().
bool QuaGzipFile::open | ( | int | fd, |
QIODevice::OpenMode | mode | ||
) | [virtual] |
Opens the file.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
fd | The file descriptor to read/write the GZIP file from/to. |
mode | Can be either QIODevice::Write or QIODevice::Read. ReadWrite and Append aren't supported. |
References open().
bool QuaGzipFile::flush | ( | ) | [virtual] |
Flushes data to file.
The data is written using Z_SYNC_FLUSH mode. Doesn't make any sense when reading.