QuaGzipFile Class Reference

GZIP file. More...

`#include <quagzipfile.h>`

Inheritance diagram for QuaGzipFile:
[legend]
Collaboration diagram for QuaGzipFile:
[legend]

## Public Member Functions

| QuaGzipFile ()
| Empty constructor. More...
| QuaGzipFile (QObject *parent)
| Empty constructor with a parent. More...
| QuaGzipFile (const QString &fileName, QObject *parent=NULL)
| Constructor. More...
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. More...
virtual bool | open (QIODevice::OpenMode mode)
| Opens the file. More...
virtual bool | open (int fd, QIODevice::OpenMode mode)
| Opens the file. More...
virtual bool | flush ()
| Flushes data to file. More...
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().

## Detailed Description

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.

## Constructor & Destructor Documentation

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.

Parameters

  parent | The parent object, as per QObject logic.

QuaGzipFile::QuaGzipFile | ( | const QString & | fileName,
|  | QObject * | parent = `NULL`
| ) |  |

Constructor.

Parameters

  fileName | The name of the GZIP file.
  parent | The parent object, as per QObject logic.

## Member Function Documentation

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.

Parameters

  mode | Can be either QIODevice::Write or QIODevice::Read. ReadWrite and Append aren't supported.

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.

Parameters

  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.

bool QuaGzipFile::flush | ( | ) |  |

virtual

Flushes data to file.

The data is written using Z_SYNC_FLUSH mode. Doesn't make any sense when reading.

The documentation for this class was generated from the following files:

- quazip/quagzipfile.h
- quazip/quagzipfile.cpp