\section{QuaZIODevice Class Reference}
\label{classQuaZIODevice}\index{QuaZIODevice@{QuaZIODevice}}


A class to compress/decompress {\bf QIODevice}.  




{\ttfamily \#include $<$quaziodevice.h$>$}



Inheritance diagram for QuaZIODevice:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=122pt]{classQuaZIODevice__inherit__graph}
\end{center}
\end{figure}


Collaboration diagram for QuaZIODevice:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=122pt]{classQuaZIODevice__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\bf QuaZIODevice} ({\bf QIODevice} $\ast$io, {\bf QObject} $\ast${\bf parent}=NULL)
\begin{DoxyCompactList}\small\item\em Constructor. \end{DoxyCompactList}\item 
{\bf $\sim$QuaZIODevice} ()\label{classQuaZIODevice_ab3524cef44c240c21e6b7680ee5f42de}

\begin{DoxyCompactList}\small\item\em Destructor. \end{DoxyCompactList}\item 
virtual bool {\bf flush} ()
\begin{DoxyCompactList}\small\item\em Flushes data waiting to be written. \end{DoxyCompactList}\item 
virtual bool {\bf open} ({\bf QIODevice::OpenMode} mode)
\begin{DoxyCompactList}\small\item\em Opens the device. \end{DoxyCompactList}\item 
virtual void {\bf close} ()
\begin{DoxyCompactList}\small\item\em Closes this device, but not the underlying one. \end{DoxyCompactList}\item 
{\bf QIODevice} $\ast$ {\bf getIoDevice} () const \label{classQuaZIODevice_ad63e7f1717c7d91b3c2c5ace908c98b7}

\begin{DoxyCompactList}\small\item\em Returns the underlying device. \end{DoxyCompactList}\item 
virtual bool {\bf isSequential} () const \label{classQuaZIODevice_af2697f58c228741d3715801bf48a9a8b}

\begin{DoxyCompactList}\small\item\em Returns true. \end{DoxyCompactList}\item 
virtual bool {\bf atEnd} () const \label{classQuaZIODevice_ae727c48089ca1b161323ec8423a653ab}

\begin{DoxyCompactList}\small\item\em Returns true iff the end of the compressed stream is reached. \end{DoxyCompactList}\item 
virtual qint64 {\bf bytesAvailable} () const \label{classQuaZIODevice_ac18b45c3d7009c8d231b13fe994ebcb9}

\begin{DoxyCompactList}\small\item\em Returns the number of the bytes buffered. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
virtual qint64 {\bf readData} (char $\ast$data, qint64 maxSize)\label{classQuaZIODevice_aa12b8bc9c923e543eda9ae22dbd1ecbb}

\begin{DoxyCompactList}\small\item\em Implementation of {\bf QIODevice::readData()}. \end{DoxyCompactList}\item 
virtual qint64 {\bf writeData} (const char $\ast$data, qint64 maxSize)\label{classQuaZIODevice_aab23b6badbc3548eb71ca86bf6211902}

\begin{DoxyCompactList}\small\item\em Implementation of {\bf QIODevice::writeData()}. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
A class to compress/decompress {\bf QIODevice}. 

This class can be used to compress any data written to {\bf QIODevice} or decompress it back. Compressing data sent over a QTcpSocket is a good example. 

\subsection{Constructor \& Destructor Documentation}
\index{QuaZIODevice@{QuaZIODevice}!QuaZIODevice@{QuaZIODevice}}
\index{QuaZIODevice@{QuaZIODevice}!QuaZIODevice@{QuaZIODevice}}
\subsubsection[{QuaZIODevice}]{\setlength{\rightskip}{0pt plus 5cm}QuaZIODevice::QuaZIODevice (
\begin{DoxyParamCaption}
\item[{{\bf QIODevice} $\ast$}]{io, }
\item[{{\bf QObject} $\ast$}]{parent = {\ttfamily NULL}}
\end{DoxyParamCaption}
)}\label{classQuaZIODevice_a8321ed35ee9b57cf9b1104912e236361}


Constructor. 


\begin{DoxyParams}{Parameters}
{\em io} & The {\bf QIODevice} to read/write. \\
\hline
{\em parent} & The parent object, as per {\bf QObject} logic. \\
\hline
\end{DoxyParams}


References QObject::connect(), and QIODevice::readyRead().



\subsection{Member Function Documentation}
\index{QuaZIODevice@{QuaZIODevice}!flush@{flush}}
\index{flush@{flush}!QuaZIODevice@{QuaZIODevice}}
\subsubsection[{flush}]{\setlength{\rightskip}{0pt plus 5cm}bool QuaZIODevice::flush (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  [virtual]}}\label{classQuaZIODevice_a25f586eb564841b51c395fd17f1cc080}


Flushes data waiting to be written. 

Unfortunately, as {\bf QIODevice} doesn't support \doxyref{flush()}{p.}{classQuaZIODevice_a25f586eb564841b51c395fd17f1cc080} by itself, the only thing this method does is write the compressed data into the device using Z\_\-SYNC\_\-FLUSH mode. If you need the compressed data to actually be flushed from the buffer of the underlying {\bf QIODevice}, you need to call its \doxyref{flush()}{p.}{classQuaZIODevice_a25f586eb564841b51c395fd17f1cc080} method as well, providing it supports it (like QTcpSocket does). Example: 
\begin{DoxyCode}
    QuaZIODevice dev(&sock);
    dev.open(QIODevice::Write);
    dev.write(yourDataGoesHere);
    dev.flush();
    sock->flush(); // this actually sends data to network
\end{DoxyCode}


This may change in the future versions of QuaZIP by implementing an ugly hack: trying to cast the {\bf QIODevice} using qobject\_\-cast to known \doxyref{flush()}{p.}{classQuaZIODevice_a25f586eb564841b51c395fd17f1cc080}-\/supporting subclasses, and calling flush if the resulting pointer is not zero. 

References QString::fromLocal8Bit(), and QIODevice::setErrorString().



Referenced by close().

\index{QuaZIODevice@{QuaZIODevice}!open@{open}}
\index{open@{open}!QuaZIODevice@{QuaZIODevice}}
\subsubsection[{open}]{\setlength{\rightskip}{0pt plus 5cm}bool QuaZIODevice::open (
\begin{DoxyParamCaption}
\item[{{\bf QIODevice::OpenMode}}]{mode}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  [virtual]}}\label{classQuaZIODevice_a175446c18eb20c9aff6faf23f09cc67a}


Opens the device. 


\begin{DoxyParams}{Parameters}
{\em mode} & Neither QIODevice::ReadWrite nor QIODevice::Append are not supported. \\
\hline
\end{DoxyParams}


References QIODevice::setErrorString(), and QObject::trUtf8().

\index{QuaZIODevice@{QuaZIODevice}!close@{close}}
\index{close@{close}!QuaZIODevice@{QuaZIODevice}}
\subsubsection[{close}]{\setlength{\rightskip}{0pt plus 5cm}void QuaZIODevice::close (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  [virtual]}}\label{classQuaZIODevice_ad27e447544d57f897316ee6f44535895}


Closes this device, but not the underlying one. 

The underlying {\bf QIODevice} is not closed in case you want to write something else to it. 

Reimplemented from {\bf QIODevice}.



References flush(), QIODevice::openMode(), and QIODevice::setErrorString().



Referenced by $\sim$QuaZIODevice().



The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
quazip/quaziodevice.h\item 
quazip/quaziodevice.cpp\end{DoxyCompactItemize}
