A class to compress/decompress QIODevice. More...
|QuaZIODevice (QIODevice *io, QObject *parent=NULL)|
|virtual bool||flush ()|
|Flushes data waiting to be written. |
|virtual bool||open (QIODevice::OpenMode mode)|
|Opens the device. |
|virtual void||close ()|
|Closes this device, but not the underlying one. |
|QIODevice *||getIoDevice () const|
|Returns the underlying device. |
|virtual bool||isSequential () const|
|Returns true. |
|virtual bool||atEnd () const|
|Returns true iff the end of the compressed stream is reached. |
|virtual qint64||bytesAvailable () const|
|Returns the number of the bytes buffered. |
|virtual qint64||readData (char *data, qint64 maxSize)|
|Implementation of QIODevice::readData(). |
|virtual qint64||writeData (const char *data, qint64 maxSize)|
|Implementation of QIODevice::writeData(). |
A class to compress/decompress QIODevice.
This class can be used to compress any data written to QIODevice or decompress it back. Compressing data sent over a QTcpSocket is a good example.
|QObject *||parent =
|io||The QIODevice to read/write.|
|parent||The parent object, as per QObject logic.|
Flushes data waiting to be written.
Unfortunately, as QIODevice doesn't support flush() by itself, the only thing this method does is write the compressed data into the device using Z_SYNC_FLUSH mode. If you need the compressed data to actually be flushed from the buffer of the underlying QIODevice, you need to call its flush() method as well, providing it supports it (like QTcpSocket does). Example:
QuaZIODevice dev(&sock); dev.open(QIODevice::Write); dev.write(yourDataGoesHere); dev.flush(); sock->flush(); // this actually sends data to network
This may change in the future versions of QuaZIP by implementing an ugly hack: trying to cast the QIODevice using qobject_cast to known flush()-supporting subclasses, and calling flush if the resulting pointer is not zero.
Referenced by close().
Opens the device.
|mode||Neither QIODevice::ReadWrite nor QIODevice::Append are not supported.|