QuaZIP quazip-0-7-2
Public Member Functions | Protected Member Functions
QuaGzipFile Class Reference

GZIP file. More...

#include <quagzipfile.h>

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

List of all members.

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().

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:
parentThe parent object, as per QObject logic.
QuaGzipFile::QuaGzipFile ( const QString fileName,
QObject parent = NULL 
)

Constructor.

Parameters:
fileNameThe name of the GZIP file.
parentThe 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.

Reimplemented from QIODevice.

bool QuaGzipFile::open ( QIODevice::OpenMode  mode) [virtual]

Opens the file.

Parameters:
modeCan be either QIODevice::Write or QIODevice::Read. ReadWrite and Append aren't supported.

References QIODevice::setErrorString().

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.

Parameters:
fdThe file descriptor to read/write the GZIP file from/to.
modeCan be either QIODevice::Write or QIODevice::Read. ReadWrite and Append aren't supported.

References open(), and QIODevice::setErrorString().

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: