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.
| QuaGzipFile (QObject *parent)
| Empty constructor with a parent.
| QuaGzipFile (const QString &fileName, QObject *parent=nullptr)
| Constructor.
| ~QuaGzipFile () override
| 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.
bool | isSequential () const override
| Returns true.
bool | open (QIODevice::OpenMode mode) override
| Opens the file.
virtual bool | open (int fd, QIODevice::OpenMode mode)
| Opens the file.
virtual bool | flush ()
| Flushes data to file.
void | close () override
| Closes the file.

## Protected Member Functions

qint64 | readData (char *data, qint64 maxSize) override
| Implementation of QIODevice::readData().
qint64 | writeData (const char *data, qint64 maxSize) override
| 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() [1/3]

QuaGzipFile::QuaGzipFile | ( |  | ) |

Empty constructor.

Must call setFileName() before trying to open.

## QuaGzipFile() [2/3]

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() [3/3]

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

Constructor.

Parameters

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

## Member Function Documentation

## isSequential()

bool QuaGzipFile::isSequential | ( |  | ) | const

override

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.

## open() [1/2]

bool QuaGzipFile::open | ( | QIODevice::OpenMode | mode | ) |

override

Opens the file.

Parameters

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

## open() [2/2]

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.

## flush()

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