23 #include "kqiodevicegzip_p.h"
25 KQIODeviceGZip::KQIODeviceGZip(
const TQString& filename)
30 setFlags(IO_Sequential);
34 KQIODeviceGZip::~KQIODeviceGZip(
void)
40 bool KQIODeviceGZip::open(
int mode)
44 if (m_filename.isEmpty())
47 if (IO_ReadOnly==mode)
49 m_gzfile=gzopen(TQFile::encodeName(m_filename),
"rb");
51 else if (IO_WriteOnly==mode)
53 m_gzfile=gzopen(TQFile::encodeName(m_filename),
"wb9");
63 void KQIODeviceGZip::close(
void)
77 gzflush(m_gzfile,Z_SYNC_FLUSH);
81 TQIODevice::Offset KQIODeviceGZip::size(
void)
const
86 TQIODevice::Offset KQIODeviceGZip::at()
const
90 return gztell(m_gzfile);
93 bool KQIODeviceGZip::at(TQIODevice::Offset pos)
97 return (gzseek(m_gzfile,pos,SEEK_SET)>=0);
100 bool KQIODeviceGZip::atEnd()
const
104 return gzeof(m_gzfile);
107 bool KQIODeviceGZip::reset(
void)
111 return (gzrewind(m_gzfile)>=0);
114 TQ_LONG KQIODeviceGZip::readBlock(
char *data, TQ_ULONG maxlen )
119 result=gzread(m_gzfile,data,maxlen);
120 if (result<0) result=0;
125 TQ_LONG KQIODeviceGZip::writeBlock(
const char *data, TQ_ULONG len )
130 result=gzwrite(m_gzfile,(
char*)data,len);
135 int KQIODeviceGZip::getch()
139 const int ch=m_ungetchar;
145 return gzgetc(m_gzfile);
148 int KQIODeviceGZip::putch(
int ch)
152 return gzputc(m_gzfile,ch);
155 int KQIODeviceGZip::ungetch(
int ch)
kndbgstream & flush(kndbgstream &s)
Does nothing.
TDEAction * close(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name=0)