#include <kfilterdev.h>
Inherits TQIODevice.
Public Member Functions | |
KFilterDev (KFilterBase *filter, bool autoDeleteFilterBase=false) | |
virtual | ~KFilterDev () |
virtual bool | open (int mode) |
virtual void | close () |
virtual void | flush () |
void | setOrigFileName (const TQCString &fileName) |
void | setSkipHeaders () |
virtual TQIODevice::Offset | size () const |
virtual TQIODevice::Offset | at () const |
virtual bool | at (TQIODevice::Offset) |
virtual bool | atEnd () const |
virtual TQ_LONG | readBlock (char *data, TQ_ULONG maxlen) |
virtual TQ_LONG | writeBlock (const char *data, TQ_ULONG len) |
virtual int | getch () |
virtual int | putch (int) |
virtual int | ungetch (int) |
Static Public Member Functions | |
static TQIODevice * | createFilterDevice (KFilterBase *base, TQFile *file) KDE_DEPRECATED |
static TQIODevice * | deviceForFile (const TQString &fileName, const TQString &mimetype=TQString::null, bool forceFilter=false) |
static TQIODevice * | device (TQIODevice *inDevice, const TQString &mimetype) |
static TQIODevice * | device (TQIODevice *inDevice, const TQString &mimetype, bool autoDeleteInDevice) |
Detailed Description
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.
Definition at line 36 of file kfilterdev.h.
Constructor & Destructor Documentation
◆ KFilterDev()
KFilterDev::KFilterDev | ( | KFilterBase * | filter, |
bool | autoDeleteFilterBase = false |
||
) |
Constructs a KFilterDev for a given filter (e.g.
gzip, bzip2 etc.).
- Parameters
-
filter the KFilterBase to use autoDeleteFilterBase when true this object will become the owner of filter
.
Definition at line 46 of file kfilterdev.cpp.
◆ ~KFilterDev()
|
virtual |
Destructs the KFilterDev.
Calls close() if the filter device is still open.
Definition at line 54 of file kfilterdev.cpp.
Member Function Documentation
◆ at()
|
virtual |
That one can be quite slow, when going back.
Use with care.
Definition at line 190 of file kfilterdev.cpp.
◆ close()
|
virtual |
Close after reading or writing.
If the KFilterBase's device was opened by open(), it will be closed.
Definition at line 149 of file kfilterdev.cpp.
◆ createFilterDevice()
|
static |
Call this to create the appropriate filter device for base
working on file
.
The returned TQIODevice has to be deleted after using.
- Deprecated:
- . Use deviceForFile instead. To be removed in KDE 3.0
Definition at line 66 of file kfilterdev.cpp.
◆ device() [1/2]
|
static |
Creates an i/o device that is able to read from the TQIODevice 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 TQIODevice has to be deleted after using.
- Parameters
-
inDevice input device, becomes owned by this device! Automatically deleted! mimetype the mime type for the filter
- Returns
- a TQIODevice that filters the original stream. Must be deleted after using
Definition at line 101 of file kfilterdev.cpp.
◆ device() [2/2]
|
static |
Creates an i/o device that is able to read from the TQIODevice 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 TQIODevice has to be deleted after using.
- Parameters
-
inDevice input device. Won't be deleted if autoDeleteInDevice
= falsemimetype the mime type for the filter autoDeleteInDevice if true, inDevice
will be deleted automatically
- Returns
- a TQIODevice that filters the original stream. Must be deleted after using
- Since
- 3.1
Definition at line 106 of file kfilterdev.cpp.
◆ 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 TQFile 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 TQIODevice has to be deleted after using.
- Parameters
-
fileName the name of the file to filter mimetype the mime type of the file to filter, or TQString::null if unknown forceFilter if true, the function will either find a compression filter, or return 0. If false, it will always return a TQIODevice. If no filter is available it will return a simple TQFile. This can be useful if the file is usable without a filter.
- Returns
- if a filter has been found, the TQIODevice for the filter. If the filter does not exist, the return value depends on
forceFilter
. The returned TQIODevice has to be deleted after using.
Definition at line 81 of file kfilterdev.cpp.
◆ open()
|
virtual |
Open for reading or writing.
If the KFilterBase's device is not opened, it will be opened.
Definition at line 119 of file kfilterdev.cpp.
◆ setOrigFileName()
void KFilterDev::setOrigFileName | ( | const TQCString & | fileName | ) |
For writing gzip compressed files only: set the name of the original file, to be used in the gzip header.
- Parameters
-
fileName the name of the original file
Definition at line 472 of file kfilterdev.cpp.
◆ setSkipHeaders()
void KFilterDev::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.
- Since
- 3.1
Definition at line 477 of file kfilterdev.cpp.
The documentation for this class was generated from the following files: