KZip Class Reference
A class for reading/writing zip archives. More...
#include <kzip.h>
Inheritance diagram for KZip:

Public Methods | |
KZip (const QString &filename) | |
Creates an instance that operates on the given filename. | |
KZip (QIODevice *dev) | |
Creates an instance that operates on the given device. | |
virtual | ~KZip () |
If the zip file is still opened, then it will be closed automatically by the destructor. | |
QString | fileName () |
The name of the zip file, as passed to the constructor Null if you used the QIODevice constructor. | |
void | setCompression (Compression c) |
Call this before writeFile or prepareWriting, to define whether the next files to be written should be compressed or not. | |
virtual bool | writeFile (const QString &name, const QString &user, const QString &group, uint size, const char *data) |
If an archive is opened for writing then you can add a new file using this function. | |
virtual bool | prepareWriting (const QString &name, const QString &user, const QString &group, uint size) |
Alternative method: call prepareWriting, writeData in small chunks, doneWriting. | |
virtual bool | doneWriting (uint size) |
Call doneWriting after writing the data. | |
Protected Methods | |
virtual bool | openArchive (int mode) |
Opens the archive for reading. | |
virtual bool | closeArchive () |
Closes the archive. | |
virtual bool | writeDir (const QString &, const QString &, const QString &) |
If an archive is opened for writing then you can add new directories using this function. | |
virtual void | virtual_hook (int id, void *data) |
Detailed Description
A class for reading/writing zip archives.
- Author:
- Holger Schroeder <holger-kde@holgis.net>
- Since:
- 3.1
Definition at line 54 of file kzip.h.
Constructor & Destructor Documentation
|
Creates an instance that operates on the given filename. using the compression filter associated to given mimetype.
|
|
Creates an instance that operates on the given device. The device can be compressed (KFilterDev) or not (QFile, etc.). WARNING: don't assume that giving a QFile here will decompress the file, in case it's compressed! |
|
If the zip file is still opened, then it will be closed automatically by the destructor.
Definition at line 136 of file kzip.cpp. References KArchive::close(), KArchive::device(), QString::isEmpty(), and KArchive::isOpened(). |
Member Function Documentation
|
The name of the zip file, as passed to the constructor Null if you used the QIODevice constructor.
Definition at line 83 of file kzip.h. Referenced by prepareWriting(). |
|
Call this before writeFile or prepareWriting, to define whether the next files to be written should be compressed or not.
|
|
If an archive is opened for writing then you can add a new file using this function. This method takes the whole data at once.
Reimplemented from KArchive. Definition at line 539 of file kzip.cpp. References QIODevice::at(), KArchive::device(), doneWriting(), and prepareWriting(). |
|
Alternative method: call prepareWriting, writeData in small chunks, doneWriting.
Implements KArchive. Definition at line 566 of file kzip.cpp. References KArchiveDirectory::addEntry(), QPtrListIterator::current(), KArchiveEntry::datetime(), KFilterDev::device(), KArchive::device(), QFile::encodeName(), fileName(), KArchive::findOrCreate(), QString::findRev(), KArchive::isOpened(), QString::left(), QCString::length(), QString::length(), QString::mid(), KArchive::mode(), KArchive::rootDir(), and QIODevice::writeBlock(). Referenced by writeFile(). |
|
Call doneWriting after writing the data.
Implements KArchive. Definition at line 696 of file kzip.cpp. References QIODevice::at(), and KArchive::device(). Referenced by writeFile(). |
|
Opens the archive for reading. Parses the directory listing of the archive and creates the KArchiveDirectory/KArchiveFile entries. Implements KArchive. Definition at line 147 of file kzip.cpp. References KArchiveDirectory::addEntry(), QIODevice::at(), QDir::cleanDirPath(), KArchive::device(), QString::endsWith(), KArchive::findOrCreate(), QString::findRev(), QString::fromLocal8Bit(), QString::isEmpty(), QString::left(), QString::length(), QString::mid(), KArchive::mode(), QIODevice::readBlock(), and KArchive::rootDir(). |
|
Closes the archive. Called by close. Implements KArchive. Definition at line 376 of file kzip.cpp. References QIODevice::at(), QPtrListIterator::current(), KArchive::device(), QFile::encodeName(), QCString::length(), KArchive::mode(), QPtrListIterator::toFirst(), and QIODevice::writeBlock(). |
|
If an archive is opened for writing then you can add new directories using this function. KArchive won't write one directory twice. Implements KArchive. |
The documentation for this class was generated from the following files: