.TH "KFilterDev" 3 "28 Jan 2004" "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
.RI "\fIConstructs a KFilterDev for a given filter (e.g. \fP"
.ti -1c
.RI "virtual \fB~KFilterDev\fP ()"
.br
.RI "\fIDestructs the KFilterDev. \fP"
.ti -1c
.RI "virtual bool \fBopen\fP (int \fBmode\fP)"
.br
.RI "\fIOpen for reading or writing. \fP"
.ti -1c
.RI "virtual void \fBclose\fP ()"
.br
.RI "\fIClose after reading or writing. \fP"
.ti -1c
.RI "virtual void \fBflush\fP ()"
.br
.ti -1c
.RI "void \fBsetOrigFileName\fP (const  \fBQCString\fP &fileName)"
.br
.RI "\fIFor writing gzip compressed files only: set the name of the original file, to be used in the gzip header. \fP"
.ti -1c
.RI "void \fBsetSkipHeaders\fP ()"
.br
.RI "\fICall this let this device skip the gzip headers when reading/writing. \fP"
.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
.RI "\fIThat one can be quite slow, when going back. \fP"
.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 "\fBQIODevice\fP * \fBcreateFilterDevice\fP (\fBKFilterBase\fP *base, \fBQFile\fP *file)"
.br
.RI "\fICall this to create the appropriate filter device for \fCbase\fP working on \fCfile\fP . \fP"
.ti -1c
.RI "\fBQIODevice\fP * \fBdeviceForFile\fP (const  \fBQString\fP &fileName, const  \fBQString\fP &mimetype=QString::null, bool forceFilter=false)"
.br
.RI "\fICreates an i/o device that is able to read from \fCfileName\fP, whether it's compressed or not. \fP"
.ti -1c
.RI "\fBQIODevice\fP * \fBdevice\fP (\fBQIODevice\fP *inDevice, const  \fBQString\fP &mimetype)"
.br
.RI "\fICreates an i/o device that is able to read from the \fBQIODevice\fP \fCinDevice\fP, whether the data is compressed or not. \fP"
.ti -1c
.RI "\fBQIODevice\fP * \fBdevice\fP (\fBQIODevice\fP *inDevice, const  \fBQString\fP &mimetype, bool autoDeleteInDevice)"
.br
.RI "\fICreates an i/o device that is able to read from the \fBQIODevice\fP \fCinDevice\fP, whether the data is compressed or not. \fP"
.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 \fBdeviceForFile\fP.
.PP
\fBAuthor:\fP
.RS 4
David Faure <faure@kde.org> 
.RE
.PP

.PP
Definition at line 35 of file kfilterdev.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KFilterDev::KFilterDev (\fBKFilterBase\fP * filter, bool autodeleteFilterBase = false)"
.PP
Constructs a KFilterDev for a given filter (e.g. gzip, bzip2 etc.) 
.PP
\fBParameters:\fP
.RS 4
\fIautoDeleteFilterbase\fP when true this object will become the owner of \fCfilter\fP. 
.RE
.PP
Definition at line 42 of file kfilterdev.cpp.
.PP
Referenced by createFilterDevice(), device(), and deviceForFile().
.SS "KFilterDev::~\fBKFilterDev\fP ()\fC [virtual]\fP"
.PP
Destructs the KFilterDev. Calls \fBclose()\fP if the filter device is still open. Definition at line 50 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. If the KFilterBase's device is not opened, it will be opened. Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 115 of file kfilterdev.cpp.
.PP
References KFilterBase::device(), KFilterBase::init(), QIODevice::isOpen(), QIODevice::open(), and KFilterBase::setOutBuffer().
.SS "void KFilterDev::close ()\fC [virtual]\fP"
.PP
Close after reading or writing. If the KFilterBase's device was opened by \fBopen()\fP, it will be closed. Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 145 of file kfilterdev.cpp.
.PP
References QIODevice::close(), KFilterBase::device(), 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. Definition at line 416 of file kfilterdev.cpp.
.SS "void KFilterDev::setSkipHeaders ()"
.PP
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 \fBKZip\fP. 
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 421 of file kfilterdev.cpp.
.SS "bool KFilterDev::at (\fBQIODevice::Offset\fP)\fC [virtual]\fP"
.PP
That one can be quite slow, when going back. Use with care. Definition at line 184 of file kfilterdev.cpp.
.PP
References QIODevice::at(), KFilterBase::device(), KFilterBase::mode(), QIODevice::Offset(), 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 . The returned \fBQIODevice\fP has to be deleted after using. \fBThis class or method is obsolete, it is provided for compatibility only.\fP. Use \fBdeviceForFile\fP instead. To be removed in \fBKDE\fP 3.0 Definition at line 62 of file kfilterdev.cpp.
.PP
References KFilterDev(), QFile::name(), and KFilterBase::setDevice().
.SS "\fBQIODevice\fP * KFilterDev::deviceForFile (const \fBQString\fP & fileName, const \fBQString\fP & mimetype = QString::null, bool forceFilter = false)\fC [static]\fP"
.PP
Creates an i/o device that is able to read from \fCfileName\fP, whether it's compressed or not. 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. Definition at line 77 of file kfilterdev.cpp.
.PP
References KFilterBase::findFilterByFileName(), KFilterBase::findFilterByMimeType(), KFilterDev(), KIO::mimetype(), 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. 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! 
.RE
.PP
Definition at line 97 of file kfilterdev.cpp.
.PP
References KIO::mimetype().
.PP
Referenced by KZip::prepareWriting().
.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. 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 
.RE
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 102 of file kfilterdev.cpp.
.PP
References KFilterBase::findFilterByMimeType(), KFilterDev(), KIO::mimetype(), and KFilterBase::setDevice().

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