KIO
KZip Class Reference
This class implements a kioslave to access zip files from KDE. More...
#include <kzip.h>

Public Types | |
enum | Compression { NoCompression = 0, DeflateCompression = 1 } |
enum | ExtraField { NoExtraField = 0, ModificationTime = 1, DefaultExtraField = 1 } |
Public Member Functions | |
Compression | compression () const |
ExtraField | extraField () const |
KZip (QIODevice *dev) | |
KZip (const QString &filename) | |
void | setCompression (Compression c) |
void | setExtraField (ExtraField ef) |
virtual bool | writeData (const char *data, qint64 size) |
virtual | ~KZip () |
Protected Member Functions | |
virtual bool | closeArchive () |
virtual bool | doFinishWriting (qint64 size) |
virtual bool | doPrepareWriting (const QString &name, const QString &user, const QString &group, qint64 size, mode_t perm, time_t atime, time_t mtime, time_t ctime) |
virtual bool | doWriteDir (const QString &name, const QString &user, const QString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime) |
virtual bool | doWriteSymLink (const QString &name, const QString &target, const QString &user, const QString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime) |
virtual bool | openArchive (QIODevice::OpenMode mode) |
virtual void | virtual_hook (int id, void *data) |
Detailed Description
This class implements a kioslave to access zip files from KDE.You can use it in QIODevice::ReadOnly or in QIODevice::WriteOnly mode, and it behaves just as expected. It can also be used in QIODevice::ReadWrite mode, in this case one can append files to an existing zip archive. When you append new files, which are not yet in the zip, it works as expected, i.e. the files are appended at the end. When you append a file, which is already in the file, the reference to the old file is dropped and the new one is added to the zip - but the old data from the file itself is not deleted, it is still in the zipfile. so when you want to have a small and garbage-free zipfile, just read the contents of the appended zip file and write it to a new one in QIODevice::WriteOnly mode. This is especially important when you don't want to leak information of how intermediate versions of files in the zip were looking. For more information on the zip fileformat go to http://www.pkware.com/products/enterprise/white_papers/appnote.html A class for reading/writing zip archives.
Definition at line 44 of file kzip.h.
Member Enumeration Documentation
enum KZip::Compression |
enum KZip::ExtraField |
Constructor & Destructor Documentation
KZip::KZip | ( | const QString & | filename | ) |
KZip::KZip | ( | QIODevice * | dev | ) |
KZip::~KZip | ( | ) | [virtual] |
Member Function Documentation
bool KZip::closeArchive | ( | ) | [protected, virtual] |
KZip::Compression KZip::compression | ( | ) | const |
The current compression mode that will be used for new files.
- Returns:
- the current compression mode
- See also:
- setCompression()
bool KZip::doFinishWriting | ( | qint64 | size | ) | [protected, virtual] |
Write data to a file that has been created using prepareWriting().
- Parameters:
-
size the size of the file
- Returns:
- true if successful, false otherwise
Implements KArchive.
KZip::ExtraField KZip::extraField | ( | ) | const |
The current type of "extra field" that will be used for new files.
- Returns:
- the current type of "extra field"
- See also:
- setExtraField()
bool KZip::openArchive | ( | QIODevice::OpenMode | mode | ) | [protected, virtual] |
void KZip::setCompression | ( | Compression | c | ) |
Call this before writeFile or prepareWriting, to define whether the next files to be written should be compressed or not.
- Parameters:
-
c the new compression mode
- See also:
- compression()
void KZip::setExtraField | ( | ExtraField | ef | ) |
Call this before writeFile or prepareWriting, to define what the next file to be written should have in its extra field.
- Parameters:
-
ef the type of "extra field"
- See also:
- extraField()
void KZip::virtual_hook | ( | int | id, | |
void * | data | |||
) | [protected, virtual] |
bool KZip::writeData | ( | const char * | data, | |
qint64 | size | |||
) | [virtual] |
Write data to a file that has been created using prepareWriting().
- Parameters:
-
data a pointer to the data size the size of the chunk
- Returns:
- true if successful, false otherwise
Reimplemented from KArchive.
The documentation for this class was generated from the following files: