\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=95pt]{classKFilterDev__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KFilter\-Dev} ({\bf KFilter\-Base} $\ast$filter, bool autodelete\-Filter\-Base=false)
\begin{CompactList}\small\item\em Constructs a KFilter\-Dev for a given filter (e.g. \item\end{CompactList}\item 
virtual {\bf $\sim$KFilter\-Dev} ()
\begin{CompactList}\small\item\em Destructs the KFilter\-Dev. \item\end{CompactList}\item 
virtual bool {\bf open} (int {\bf mode})
\begin{CompactList}\small\item\em Open for reading or writing. \item\end{CompactList}\item 
virtual void {\bf close} ()
\begin{CompactList}\small\item\em Close after reading or writing. \item\end{CompactList}\item 
virtual void {\bf flush} ()\label{classKFilterDev_a4}

\item 
void {\bf set\-Orig\-File\-Name} (const  {\bf QCString} \&file\-Name)
\begin{CompactList}\small\item\em For writing gzip compressed files only: set the name of the original file, to be used in the gzip header. \item\end{CompactList}\item 
void {\bf set\-Skip\-Headers} ()
\begin{CompactList}\small\item\em Call this let this device skip the gzip headers when reading/writing. \item\end{CompactList}\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})
\begin{CompactList}\small\item\em That one can be quite slow, when going back. \item\end{CompactList}\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 
{\bf QIODevice} $\ast$ {\bf create\-Filter\-Device} ({\bf KFilter\-Base} $\ast$base, {\bf QFile} $\ast$file)
\begin{CompactList}\small\item\em Call this to create the appropriate filter device for {\tt base} working on {\tt file} . \item\end{CompactList}\item 
{\bf QIODevice} $\ast$ {\bf device\-For\-File} (const  {\bf QString} \&file\-Name, const  {\bf QString} \&mimetype=QString::null, bool force\-Filter=false)
\begin{CompactList}\small\item\em Creates an i/o device that is able to read from {\tt file\-Name}, whether it's compressed or not. \item\end{CompactList}\item 
{\bf QIODevice} $\ast$ {\bf device} ({\bf QIODevice} $\ast$in\-Device, const  {\bf QString} \&mimetype)
\begin{CompactList}\small\item\em Creates an i/o device that is able to read from the {\bf QIODevice} {\tt in\-Device}, whether the data is compressed or not. \item\end{CompactList}\item 
{\bf QIODevice} $\ast$ {\bf device} ({\bf QIODevice} $\ast$in\-Device, const  {\bf QString} \&mimetype, bool auto\-Delete\-In\-Device)
\begin{CompactList}\small\item\em Creates an i/o device that is able to read from the {\bf QIODevice} {\tt in\-Device}, whether the data is compressed or not. \item\end{CompactList}\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 {\bf device\-For\-File}{\rm (p.\,\pageref{classKFilterDev_e1})}.

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




Definition at line 35 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 autodelete\-Filter\-Base} = 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 auto\-Delete\-Filterbase}]when true this object will become the owner of {\tt filter}. \end{description}
\end{Desc}


Definition at line 42 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 50 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 115 of file kfilterdev.cpp.

References KFilter\-Base::device(), KFilter\-Base::init(), QIODevice::is\-Open(), 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 145 of file kfilterdev.cpp.

References QIODevice::close(), KFilter\-Base::device(), 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. 



Definition at line 416 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 421 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 184 of file kfilterdev.cpp.

References QIODevice::at(), KFilter\-Base::device(), KFilter\-Base::mode(), QIODevice::Offset(), 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. {\bf This class or method is obsolete, it is provided for compatibility only.}. Use {\bf device\-For\-File}{\rm (p.\,\pageref{classKFilterDev_e1})} instead. To be removed in {\bf KDE} 3.0 

Definition at line 62 of file kfilterdev.cpp.

References KFilter\-Dev(), QFile::name(), and KFilter\-Base::set\-Device().\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} = QString::null, bool {\em force\-Filter} = 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. 

Definition at line 77 of file kfilterdev.cpp.

References KFilter\-Base::find\-Filter\-By\-File\-Name(), KFilter\-Base::find\-Filter\-By\-Mime\-Type(), KFilter\-Dev(), KIO::mimetype(), 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! \end{description}
\end{Desc}


Definition at line 97 of file kfilterdev.cpp.

References KIO::mimetype().

Referenced by KZip::prepare\-Writing().\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 \end{description}
\end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 102 of file kfilterdev.cpp.

References KFilter\-Base::find\-Filter\-By\-Mime\-Type(), KFilter\-Dev(), KIO::mimetype(), 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}
