.TH "KFilterDev" kde3 "11 Jun 2005" "Version Version 3.4.1" "kio Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KFilterDev \- A class for reading and writing compressed data onto a device (e.g.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kfilterdev.h>\fP
.PP
Inherits \fBQIODevice\fP.
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKFilterDev\fP (\fBKFilterBase\fP *filter, bool autoDeleteFilterBase=false)"
.br
.ti -1c
.RI "virtual \fB~KFilterDev\fP ()"
.br
.ti -1c
.RI "virtual bool \fBopen\fP (int \fBmode\fP)"
.br
.ti -1c
.RI "virtual void \fBclose\fP ()"
.br
.ti -1c
.RI "virtual void \fBflush\fP ()"
.br
.ti -1c
.RI "void \fBsetOrigFileName\fP (const \fBQCString\fP &fileName)"
.br
.ti -1c
.RI "void \fBsetSkipHeaders\fP ()"
.br
.ti -1c
.RI "virtual \fBQIODevice::Offset\fP \fBsize\fP () const "
.br
.ti -1c
.RI "virtual \fBQIODevice::Offset\fP \fBat\fP () const "
.br
.ti -1c
.RI "virtual bool \fBat\fP (\fBQIODevice::Offset\fP)"
.br
.ti -1c
.RI "virtual bool \fBatEnd\fP () const "
.br
.ti -1c
.RI "virtual Q_LONG \fBreadBlock\fP (char *data, Q_ULONG maxlen)"
.br
.ti -1c
.RI "virtual Q_LONG \fBwriteBlock\fP (const char *data, Q_ULONG len)"
.br
.ti -1c
.RI "virtual int \fBgetch\fP ()"
.br
.ti -1c
.RI "virtual int \fBputch\fP (int)"
.br
.ti -1c
.RI "virtual int \fBungetch\fP (int)"
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static \fBQIODevice\fP * \fBcreateFilterDevice\fP (\fBKFilterBase\fP *base, \fBQFile\fP *file) KDE_DEPRECATED"
.br
.ti -1c
.RI "static \fBQIODevice\fP * \fBdeviceForFile\fP (const \fBQString\fP &fileName, const \fBQString\fP &mimetype=QString::null, bool forceFilter=false)"
.br
.ti -1c
.RI "static \fBQIODevice\fP * \fBdevice\fP (\fBQIODevice\fP *inDevice, const \fBQString\fP &mimetype)"
.br
.ti -1c
.RI "static \fBQIODevice\fP * \fBdevice\fP (\fBQIODevice\fP *inDevice, const \fBQString\fP &mimetype, bool autoDeleteInDevice)"
.br
.in -1c
.SH "Detailed Description"
.PP 
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).
.PP
To simply read/write compressed files, see deviceForFile.
.PP
\fBAuthor:\fP
.RS 4
David Faure <faure@kde.org> 
.RE
.PP

.PP
Definition at line 36 of file kfilterdev.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KFilterDev::KFilterDev (\fBKFilterBase\fP * filter, bool autoDeleteFilterBase = \fCfalse\fP)"
.PP
Constructs a KFilterDev for a given filter (e.g. 
.PP
gzip, bzip2 etc.). 
.PP
\fBParameters:\fP
.RS 4
\fIfilter\fP the \fBKFilterBase\fP to use 
.br
\fIautoDeleteFilterBase\fP when true this object will become the owner of \fCfilter\fP. 
.RE
.PP

.PP
Definition at line 46 of file kfilterdev.cpp.
.PP
Referenced by createFilterDevice(), device(), and deviceForFile().
.SS "KFilterDev::~\fBKFilterDev\fP ()\fC [virtual]\fP"
.PP
Destructs the KFilterDev. 
.PP
Calls \fBclose()\fP if the filter device is still open. 
.PP
Definition at line 54 of file kfilterdev.cpp.
.PP
References close(), and QIODevice::isOpen().
.SH "Member Function Documentation"
.PP 
.SS "bool KFilterDev::open (int mode)\fC [virtual]\fP"
.PP
Open for reading or writing. 
.PP
If the KFilterBase's device is not opened, it will be opened. 
.PP
Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 119 of file kfilterdev.cpp.
.PP
References KFilterBase::device(), endl(), KFilterBase::init(), QIODevice::isOpen(), kdWarning(), QIODevice::open(), and KFilterBase::setOutBuffer().
.SS "void KFilterDev::close ()\fC [virtual]\fP"
.PP
Close after reading or writing. 
.PP
If the KFilterBase's device was opened by \fBopen()\fP, it will be closed. 
.PP
Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 149 of file kfilterdev.cpp.
.PP
References QIODevice::close(), KFilterBase::device(), QIODevice::isOpen(), KFilterBase::mode(), KFilterBase::terminate(), and QIODevice::writeBlock().
.PP
Referenced by ~KFilterDev().
.SS "void KFilterDev::setOrigFileName (const \fBQCString\fP & fileName)"
.PP
For writing gzip compressed files only: set the name of the original file, to be used in the gzip header. 
.PP
\fBParameters:\fP
.RS 4
\fIfileName\fP the name of the original file 
.RE
.PP

.PP
Definition at line 472 of file kfilterdev.cpp.
.SS "void KFilterDev::setSkipHeaders ()"
.PP
Call this let this device skip the gzip headers when reading/writing. 
.PP
This way KFilterDev (with gzip filter) can be used as a direct wrapper around zlib - this is used by \fBKZip\fP. 
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP

.PP
Definition at line 477 of file kfilterdev.cpp.
.SS "bool KFilterDev::at (\fBQIODevice::Offset\fP)\fC [virtual]\fP"
.PP
That one can be quite slow, when going back. 
.PP
Use with care. 
.PP
Definition at line 190 of file kfilterdev.cpp.
.PP
References QIODevice::at(), KFilterBase::device(), KFilterBase::mode(), QIODevice::readBlock(), QIODevice::reset(), KFilterBase::reset(), and KFilterBase::setInBuffer().
.SS "\fBQIODevice\fP * KFilterDev::createFilterDevice (\fBKFilterBase\fP * base, \fBQFile\fP * file)\fC [static]\fP"
.PP
Call this to create the appropriate filter device for \fCbase\fP working on \fCfile\fP . 
.PP
The returned \fBQIODevice\fP has to be deleted after using. 
.PP
\fBDeprecated\fP
.RS 4
. Use deviceForFile instead. To be removed in \fBKDE\fP 3.0 
.RE
.PP

.PP
Definition at line 66 of file kfilterdev.cpp.
.PP
References KFilterDev().
.SS "\fBQIODevice\fP * KFilterDev::deviceForFile (const \fBQString\fP & fileName, const \fBQString\fP & mimetype = \fCQString::null\fP, bool forceFilter = \fCfalse\fP)\fC [static]\fP"
.PP
Creates an i/o device that is able to read from \fCfileName\fP, whether it's compressed or not. 
.PP
Available compression filters (gzip/bzip2 etc.) will automatically be used.
.PP
The compression filter to be used is determined from the \fCfileName\fP if \fCmimetype\fP is empty. Pass 'application/x-gzip' or 'application/x-bzip2' to force the corresponding decompression filter, if available.
.PP
Warning: application/x-bzip2 may not be available. In that case a \fBQFile\fP opened on the compressed data will be returned ! Use \fBKFilterBase::findFilterByMimeType\fP and code similar to what deviceForFile is doing, to better control what's happening.
.PP
The returned \fBQIODevice\fP has to be deleted after using.
.PP
\fBParameters:\fP
.RS 4
\fIfileName\fP the name of the file to filter 
.br
\fImimetype\fP the mime type of the file to filter, or QString::null if unknown 
.br
\fIforceFilter\fP if true, the function will either find a compression filter, or return 0. If false, it will always return a \fBQIODevice\fP. If no filter is available it will return a simple \fBQFile\fP. This can be useful if the file is usable without a filter. 
.RE
.PP
\fBReturns:\fP
.RS 4
if a filter has been found, the \fBQIODevice\fP for the filter. If the filter does not exist, the return value depends on \fCforceFilter\fP. The returned \fBQIODevice\fP has to be deleted after using. 
.RE
.PP

.PP
Definition at line 81 of file kfilterdev.cpp.
.PP
References KFilterBase::findFilterByFileName(), KFilterBase::findFilterByMimeType(), KFilterDev(), and KFilterBase::setDevice().
.SS "\fBQIODevice\fP * KFilterDev::device (\fBQIODevice\fP * inDevice, const \fBQString\fP & mimetype)\fC [static]\fP"
.PP
Creates an i/o device that is able to read from the \fBQIODevice\fP \fCinDevice\fP, whether the data is compressed or not. 
.PP
Available compression filters (gzip/bzip2 etc.) will automatically be used.
.PP
The compression filter to be used is determined \fCmimetype\fP . Pass 'application/x-gzip' or 'application/x-bzip2' to use the corresponding decompression filter.
.PP
Warning: application/x-bzip2 may not be available. In that case 0 will be returned !
.PP
The returned \fBQIODevice\fP has to be deleted after using. 
.PP
\fBParameters:\fP
.RS 4
\fIinDevice\fP input device, becomes owned by this device! Automatically deleted! 
.br
\fImimetype\fP the mime type for the filter 
.RE
.PP
\fBReturns:\fP
.RS 4
a \fBQIODevice\fP that filters the original stream. Must be deleted after using 
.RE
.PP

.PP
Definition at line 101 of file kfilterdev.cpp.
.SS "\fBQIODevice\fP * KFilterDev::device (\fBQIODevice\fP * inDevice, const \fBQString\fP & mimetype, bool autoDeleteInDevice)\fC [static]\fP"
.PP
Creates an i/o device that is able to read from the \fBQIODevice\fP \fCinDevice\fP, whether the data is compressed or not. 
.PP
Available compression filters (gzip/bzip2 etc.) will automatically be used.
.PP
The compression filter to be used is determined \fCmimetype\fP . Pass 'application/x-gzip' or 'application/x-bzip2' to use the corresponding decompression filter.
.PP
Warning: application/x-bzip2 may not be available. In that case 0 will be returned !
.PP
The returned \fBQIODevice\fP has to be deleted after using. 
.PP
\fBParameters:\fP
.RS 4
\fIinDevice\fP input device. Won't be deleted if \fCautoDeleteInDevice\fP = false 
.br
\fImimetype\fP the mime type for the filter 
.br
\fIautoDeleteInDevice\fP if true, \fCinDevice\fP will be deleted automatically 
.RE
.PP
\fBReturns:\fP
.RS 4
a \fBQIODevice\fP that filters the original stream. Must be deleted after using 
.RE
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP

.PP
Definition at line 106 of file kfilterdev.cpp.
.PP
References KFilterBase::findFilterByMimeType(), KFilterDev(), and KFilterBase::setDevice().

.SH "Author"
.PP 
Generated automatically by Doxygen for kio Library from the source code.
