|
|
A class for reading and writing compressed data onto a device (e.g. file, but other usages are possible, like a buffer or a socket)
To simply read/write compressed files, see deviceForFile.
| KFilterDev ( KFilterBase * filter, bool autodeleteFilterBase = false )
| KFilterDev |
Constructs a KFilterDev for a given filter (e.g. gzip, bzip2 etc.)
Parameters:
| autoDeleteFilterbase | when true this object will become the
owner of filter.
|
| ~KFilterDev ()
| ~KFilterDev |
[virtual]
Destructs the KFilterDev. Calls close() if the filter device is still open.
| bool open ( int mode )
| open |
[virtual]
Open for reading or writing. If the KFilterBase's device is not opened, it will be opened.
| void close ()
| close |
[virtual]
Close after reading or writing. If the KFilterBase's device was opened by open(), it will be closed.
| void flush ()
| flush |
[virtual]
| void setOrigFileName ( const QCString & fileName )
| setOrigFileName |
For writing gzip compressed files only: set the name of the original file, to be used in the gzip header.
| void setSkipHeaders ()
| setSkipHeaders |
Call this let this device skip the gzip headers when reading/writing. This way KFilterDev (with gzip filter) can be used as a direct wrapper around zlib - this is used by KZip.
| QIODevice::Offset size ()
| size |
[const virtual]
| QIODevice::Offset at ()
| at |
[const virtual]
| bool at ( QIODevice::Offset )
| at |
[virtual]
That one can be quite slow, when going back. Use with care.
| bool atEnd ()
| atEnd |
[const virtual]
| Q_LONG readBlock ( char *data, Q_ULONG maxlen )
| readBlock |
[virtual]
| Q_LONG writeBlock ( const char *data, Q_ULONG len )
| writeBlock |
[virtual]
| int getch ()
| getch |
[virtual]
| int putch ( int )
| putch |
[virtual]
| int ungetch ( int )
| ungetch |
[virtual]
| QIODevice* createFilterDevice (KFilterBase* base, QFile* file)
| createFilterDevice |
[static]
Call this to create the appropriate filter device for base
working on file . The returned QIODevice has to be deleted
after using.
To be removed in KDE 3.0
| QIODevice * deviceForFile ( const QString & fileName, const QString & mimetype = QString::null,
bool forceFilter = false )
| deviceForFile |
[static]
Creates an i/o device that is able to read from fileName,
whether it's compressed or not. Available compression filters
(gzip/bzip2 etc.) will automatically be used.
The compression filter to be used is determined from the fileName
if mimetype is empty. Pass "application/x-gzip" or "application/x-bzip2"
to force the corresponding decompression filter, if available.
Warning: application/x-bzip2 may not be available. In that case a QFile opened on the compressed data will be returned ! Use KFilterBase::findFilterByMimeType and code similar to what deviceForFile is doing, to better control what's happening.
The returned QIODevice has to be deleted after using.
| QIODevice * device ( QIODevice* inDevice, const QString & mimetype)
| device |
[static]
Creates an i/o device that is able to read from the QIODevice inDevice,
whether the data is compressed or not. Available compression filters
(gzip/bzip2 etc.) will automatically be used.
The compression filter to be used is determined mimetype .
Pass "application/x-gzip" or "application/x-bzip2"
to use the corresponding decompression filter.
Warning: application/x-bzip2 may not be available. In that case 0 will be returned !
The returned QIODevice has to be deleted after using.
Parameters:
| inDevice | input device, becomes owned by this device! Automatically deleted! |
| QIODevice * device ( QIODevice* inDevice, const QString & mimetype, bool autoDeleteInDevice )
| device |
[static]
Creates an i/o device that is able to read from the QIODevice inDevice,
whether the data is compressed or not. Available compression filters
(gzip/bzip2 etc.) will automatically be used.
The compression filter to be used is determined mimetype .
Pass "application/x-gzip" or "application/x-bzip2"
to use the corresponding decompression filter.
Warning: application/x-bzip2 may not be available. In that case 0 will be returned !
The returned QIODevice has to be deleted after using.
Parameters:
| inDevice | input device. Won't be deleted if autoDeleteInDevice = false
|