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


A class to compress/decompress QIODevice.  




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

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\bf QuaZIODevice} (QIODevice $\ast$io, QObject $\ast$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} (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 
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}\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 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 QIODevice::writeData(). \end{DoxyCompactList}\end{DoxyCompactItemize}


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

This class can be used to compress any data written to 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[{QIODevice $\ast$}]{io, }
\item[{QObject $\ast$}]{parent = {\ttfamily NULL}}
\end{DoxyParamCaption}
)}\label{classQuaZIODevice_a8321ed35ee9b57cf9b1104912e236361}


Constructor. 


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


\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 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 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 QIODevice using qobject\_\-cast to known \doxyref{flush()}{p.}{classQuaZIODevice_a25f586eb564841b51c395fd17f1cc080}-\/supporting subclasses, and calling flush if the resulting pointer is not zero. 

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[{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}
\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 QIODevice is not closed in case you want to write something else to it. 

References flush().



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}
