\section{KFilter\-Dev Class Reference}
\label{classKFilterDev}\index{KFilterDev@{KFilterDev}}
A class for reading and writing compressed data onto a device (e.g.  


{\tt \#include $<$kfilterdev.h$>$}

Inheritance diagram for KFilter\-Dev:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=50pt]{classKFilterDev__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KFilter\-Dev:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=92pt]{classKFilterDev__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KFilter\-Dev} ({\bf KFilter\-Base} $\ast$filter, bool auto\-Delete\-Filter\-Base=false)
\item 
virtual {\bf $\sim$KFilter\-Dev} ()
\item 
virtual bool {\bf open} (int {\bf mode})
\item 
virtual void {\bf close} ()
\item 
virtual void {\bf flush} ()\label{classKFilterDev_a4}

\item 
void {\bf set\-Orig\-File\-Name} (const {\bf QCString} \&file\-Name)
\item 
void {\bf set\-Skip\-Headers} ()
\item 
virtual {\bf QIODevice::Offset} {\bf size} () const \label{classKFilterDev_a7}

\item 
virtual {\bf QIODevice::Offset} {\bf at} () const \label{classKFilterDev_a8}

\item 
virtual bool {\bf at} ({\bf QIODevice::Offset})
\item 
virtual bool {\bf at\-End} () const \label{classKFilterDev_a10}

\item 
virtual Q\_\-LONG {\bf read\-Block} (char $\ast$data, Q\_\-ULONG maxlen)\label{classKFilterDev_a11}

\item 
virtual Q\_\-LONG {\bf write\-Block} (const char $\ast$data, Q\_\-ULONG len)\label{classKFilterDev_a12}

\item 
virtual int {\bf getch} ()\label{classKFilterDev_a13}

\item 
virtual int {\bf putch} (int)\label{classKFilterDev_a14}

\item 
virtual int {\bf ungetch} (int)\label{classKFilterDev_a15}

\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf QIODevice} $\ast$ {\bf create\-Filter\-Device} ({\bf KFilter\-Base} $\ast$base, {\bf QFile} $\ast$file) KDE\_\-DEPRECATED
\item 
static {\bf QIODevice} $\ast$ {\bf device\-For\-File} (const {\bf QString} \&file\-Name, const {\bf QString} \&mimetype=QString::null, bool force\-Filter=false)
\item 
static {\bf QIODevice} $\ast$ {\bf device} ({\bf QIODevice} $\ast$in\-Device, const {\bf QString} \&mimetype)
\item 
static {\bf QIODevice} $\ast$ {\bf device} ({\bf QIODevice} $\ast$in\-Device, const {\bf QString} \&mimetype, bool auto\-Delete\-In\-Device)
\end{CompactItemize}


\subsection{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 device\-For\-File.

\begin{Desc}
\item[Author:]David Faure $<${\tt faure@kde.org}$>$ \end{Desc}




Definition at line 36 of file kfilterdev.h.

\subsection{Constructor \& Destructor Documentation}
\index{KFilterDev@{KFilter\-Dev}!KFilterDev@{KFilterDev}}
\index{KFilterDev@{KFilterDev}!KFilterDev@{KFilter\-Dev}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KFilter\-Dev::KFilter\-Dev ({\bf KFilter\-Base} $\ast$ {\em filter}, bool {\em auto\-Delete\-Filter\-Base} = {\tt false})}\label{classKFilterDev_a0}


Constructs a KFilter\-Dev for a given filter (e.g. 

gzip, bzip2 etc.). \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em filter}]the {\bf KFilter\-Base}{\rm (p.\,\pageref{classKFilterBase})} to use \item[{\em auto\-Delete\-Filter\-Base}]when true this object will become the owner of {\tt filter}. \end{description}
\end{Desc}


Definition at line 46 of file kfilterdev.cpp.

Referenced by create\-Filter\-Device(), device(), and device\-For\-File().\index{KFilterDev@{KFilter\-Dev}!~KFilterDev@{$\sim$KFilterDev}}
\index{~KFilterDev@{$\sim$KFilterDev}!KFilterDev@{KFilter\-Dev}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KFilter\-Dev::$\sim${\bf KFilter\-Dev} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKFilterDev_a1}


Destructs the KFilter\-Dev. 

Calls {\bf close()}{\rm (p.\,\pageref{classKFilterDev_a3})} if the filter device is still open. 

Definition at line 54 of file kfilterdev.cpp.

References close(), and QIODevice::is\-Open().

\subsection{Member Function Documentation}
\index{KFilterDev@{KFilter\-Dev}!open@{open}}
\index{open@{open}!KFilterDev@{KFilter\-Dev}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KFilter\-Dev::open (int {\em mode})\hspace{0.3cm}{\tt  [virtual]}}\label{classKFilterDev_a2}


Open for reading or writing. 

If the KFilter\-Base's device is not opened, it will be opened. 

Reimplemented from {\bf QIODevice}.

Definition at line 119 of file kfilterdev.cpp.

References KFilter\-Base::device(), endl(), KFilter\-Base::init(), QIODevice::is\-Open(), kd\-Warning(), QIODevice::open(), and KFilter\-Base::set\-Out\-Buffer().\index{KFilterDev@{KFilter\-Dev}!close@{close}}
\index{close@{close}!KFilterDev@{KFilter\-Dev}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFilter\-Dev::close ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKFilterDev_a3}


Close after reading or writing. 

If the KFilter\-Base's device was opened by {\bf open()}{\rm (p.\,\pageref{classKFilterDev_a2})}, it will be closed. 

Reimplemented from {\bf QIODevice}.

Definition at line 149 of file kfilterdev.cpp.

References QIODevice::close(), KFilter\-Base::device(), QIODevice::is\-Open(), KFilter\-Base::mode(), KFilter\-Base::terminate(), and QIODevice::write\-Block().

Referenced by $\sim$KFilter\-Dev().\index{KFilterDev@{KFilter\-Dev}!setOrigFileName@{setOrigFileName}}
\index{setOrigFileName@{setOrigFileName}!KFilterDev@{KFilter\-Dev}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFilter\-Dev::set\-Orig\-File\-Name (const {\bf QCString} \& {\em file\-Name})}\label{classKFilterDev_a5}


For writing gzip compressed files only: set the name of the original file, to be used in the gzip header. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em file\-Name}]the name of the original file \end{description}
\end{Desc}


Definition at line 472 of file kfilterdev.cpp.\index{KFilterDev@{KFilter\-Dev}!setSkipHeaders@{setSkipHeaders}}
\index{setSkipHeaders@{setSkipHeaders}!KFilterDev@{KFilter\-Dev}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFilter\-Dev::set\-Skip\-Headers ()}\label{classKFilterDev_a6}


Call this let this device skip the gzip headers when reading/writing. 

This way KFilter\-Dev (with gzip filter) can be used as a direct wrapper around zlib - this is used by {\bf KZip}{\rm (p.\,\pageref{classKZip})}. \begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 477 of file kfilterdev.cpp.\index{KFilterDev@{KFilter\-Dev}!at@{at}}
\index{at@{at}!KFilterDev@{KFilter\-Dev}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KFilter\-Dev::at ({\bf QIODevice::Offset})\hspace{0.3cm}{\tt  [virtual]}}\label{classKFilterDev_a9}


That one can be quite slow, when going back. 

Use with care. 

Definition at line 190 of file kfilterdev.cpp.

References QIODevice::at(), KFilter\-Base::device(), KFilter\-Base::mode(), QIODevice::read\-Block(), QIODevice::reset(), KFilter\-Base::reset(), and KFilter\-Base::set\-In\-Buffer().\index{KFilterDev@{KFilter\-Dev}!createFilterDevice@{createFilterDevice}}
\index{createFilterDevice@{createFilterDevice}!KFilterDev@{KFilter\-Dev}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QIODevice} $\ast$ KFilter\-Dev::create\-Filter\-Device ({\bf KFilter\-Base} $\ast$ {\em base}, {\bf QFile} $\ast$ {\em file})\hspace{0.3cm}{\tt  [static]}}\label{classKFilterDev_e0}


Call this to create the appropriate filter device for {\tt base} working on {\tt file} . 

The returned {\bf QIODevice} has to be deleted after using. 

\begin{Desc}
\item[{\bf Deprecated}]. Use device\-For\-File instead. To be removed in {\bf KDE} 3.0 \end{Desc}


Definition at line 66 of file kfilterdev.cpp.

References KFilter\-Dev().\index{KFilterDev@{KFilter\-Dev}!deviceForFile@{deviceForFile}}
\index{deviceForFile@{deviceForFile}!KFilterDev@{KFilter\-Dev}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QIODevice} $\ast$ KFilter\-Dev::device\-For\-File (const {\bf QString} \& {\em file\-Name}, const {\bf QString} \& {\em mimetype} = {\tt QString::null}, bool {\em force\-Filter} = {\tt false})\hspace{0.3cm}{\tt  [static]}}\label{classKFilterDev_e1}


Creates an i/o device that is able to read from {\tt file\-Name}, 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 {\tt file\-Name} if {\tt mimetype} is empty. Pass \char`\"{}application/x-gzip\char`\"{} or \char`\"{}application/x-bzip2\char`\"{} to force the corresponding decompression filter, if available.

Warning: application/x-bzip2 may not be available. In that case a {\bf QFile} opened on the compressed data will be returned ! Use {\bf KFilter\-Base::find\-Filter\-By\-Mime\-Type}{\rm (p.\,\pageref{classKFilterBase_e1})} and code similar to what device\-For\-File is doing, to better control what's happening.

The returned {\bf QIODevice} has to be deleted after using.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em file\-Name}]the name of the file to filter \item[{\em mimetype}]the mime type of the file to filter, or QString::null if unknown \item[{\em force\-Filter}]if true, the function will either find a compression filter, or return 0. If false, it will always return a {\bf QIODevice}. If no filter is available it will return a simple {\bf QFile}. This can be useful if the file is usable without a filter. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]if a filter has been found, the {\bf QIODevice} for the filter. If the filter does not exist, the return value depends on {\tt force\-Filter}. The returned {\bf QIODevice} has to be deleted after using. \end{Desc}


Definition at line 81 of file kfilterdev.cpp.

References KFilter\-Base::find\-Filter\-By\-File\-Name(), KFilter\-Base::find\-Filter\-By\-Mime\-Type(), KFilter\-Dev(), and KFilter\-Base::set\-Device().\index{KFilterDev@{KFilter\-Dev}!device@{device}}
\index{device@{device}!KFilterDev@{KFilter\-Dev}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QIODevice} $\ast$ KFilter\-Dev::device ({\bf QIODevice} $\ast$ {\em in\-Device}, const {\bf QString} \& {\em mimetype})\hspace{0.3cm}{\tt  [static]}}\label{classKFilterDev_e2}


Creates an i/o device that is able to read from the {\bf QIODevice} {\tt in\-Device}, 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 {\tt mimetype} . Pass \char`\"{}application/x-gzip\char`\"{} or \char`\"{}application/x-bzip2\char`\"{} to use the corresponding decompression filter.

Warning: application/x-bzip2 may not be available. In that case 0 will be returned !

The returned {\bf QIODevice} has to be deleted after using. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in\-Device}]input device, becomes owned by this device! Automatically deleted! \item[{\em mimetype}]the mime type for the filter \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a {\bf QIODevice} that filters the original stream. Must be deleted after using \end{Desc}


Definition at line 101 of file kfilterdev.cpp.\index{KFilterDev@{KFilter\-Dev}!device@{device}}
\index{device@{device}!KFilterDev@{KFilter\-Dev}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QIODevice} $\ast$ KFilter\-Dev::device ({\bf QIODevice} $\ast$ {\em in\-Device}, const {\bf QString} \& {\em mimetype}, bool {\em auto\-Delete\-In\-Device})\hspace{0.3cm}{\tt  [static]}}\label{classKFilterDev_e3}


Creates an i/o device that is able to read from the {\bf QIODevice} {\tt in\-Device}, 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 {\tt mimetype} . Pass \char`\"{}application/x-gzip\char`\"{} or \char`\"{}application/x-bzip2\char`\"{} to use the corresponding decompression filter.

Warning: application/x-bzip2 may not be available. In that case 0 will be returned !

The returned {\bf QIODevice} has to be deleted after using. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in\-Device}]input device. Won't be deleted if {\tt auto\-Delete\-In\-Device} = false \item[{\em mimetype}]the mime type for the filter \item[{\em auto\-Delete\-In\-Device}]if true, {\tt in\-Device} will be deleted automatically \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a {\bf QIODevice} that filters the original stream. Must be deleted after using \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 106 of file kfilterdev.cpp.

References KFilter\-Base::find\-Filter\-By\-Mime\-Type(), KFilter\-Dev(), and KFilter\-Base::set\-Device().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kfilterdev.h\item 
kfilterdev.cpp\end{CompactItemize}
