KDECore
kzip.cpp
Go to the documentation of this file.
385 QList<KZipFileEntry*> m_fileList; // flat list of all files, for the index (saves a recursive method ;)
536 //kDebug(7040) << "general purpose bit flag indicates, that local file header contains valid size";
614 kWarning(7040) << "Invalid ZIP file, central entry too short"; // not long enough for valid entry
668 uint dataoffset = localheaderoffset + 30 + localextralen + namelen; //comment only in central header
710 entry = new KArchiveDirectory( this, entryName, access, (int)pfi.mtime, rootDir()->user(), rootDir()->group(), QString() );
1008 // However, to support empty directories, we must create a dummy file entry which ends with '/'.
1176 d->m_currentDev = KFilterDev::device( device(), QString::fromLatin1("application/x-gzip"), false );
1388 //kDebug(7040) << "creating iodevice limited to pos=" << position() << ", csize=" << compressedSize();
1390 KLimitedIODevice* limitedDev = new KLimitedIODevice( archive()->device(), position(), compressedSize() );
1397 QIODevice* filterDev = KFilterDev::device( limitedDev, QString::fromLatin1("application/x-gzip") );
virtual bool writeFile(const QString &name, const QString &user, const QString &group, const char *data, qint64 size, mode_t perm=0100644, time_t atime=UnknownTime, time_t mtime=UnknownTime, time_t ctime=UnknownTime)
If an archive is opened for writing then you can add a new file using this function.
Definition: karchive.cpp:319
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)
Reimplemented from KArchive.
Definition: kzip.cpp:1015
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)
Reimplemented from KArchive.
Definition: kzip.cpp:1225
static QIODevice * device(QIODevice *inDevice, const QString &mimetype, bool autoDeleteInDevice=true)
Creates an i/o device that is able to read from the QIODevice inDevice, whether the data is compresse...
Definition: kfilterdev.cpp:84
static void transformToMsDos(const QDateTime &dt, char *buffer)
Definition: kzip.cpp:38
static bool parseExtraField(const char *buffer, int size, bool islocal, ParseFileInfo &pfi)
parses the extra field
Definition: kzip.cpp:243
virtual KArchiveDirectory * rootDir()
Retrieves or create the root directory.
Definition: karchive.cpp:391
static bool handlePossibleHeaderBegin(const char *buffer, QIODevice *dev)
Checks if a token for a central or local header has been found and resets the device to the begin of ...
Definition: kzip.cpp:295
void setCompression(Compression c)
Call this before writeFile or prepareWriting, to define whether the next files to be written should b...
Definition: kzip.cpp:1279
void setExtraField(ExtraField ef)
Call this before writeFile or prepareWriting, to define what the next file to be written should have ...
Definition: kzip.cpp:1289
QString fileName() const
The name of the archive file, as passed to the constructor that takes a fileName, or an empty string ...
Definition: karchive.cpp:485
virtual bool doFinishWriting(qint64 size)
Write data to a file that has been created using prepareWriting().
Definition: kzip.cpp:1188
KZip(const QString &filename)
Creates an instance that operates on the given filename.
Definition: kzip.cpp:395
KZipFileEntry(KZip *zip, const QString &name, int access, int date, const QString &user, const QString &group, const QString &symlink, const QString &path, qint64 start, qint64 uncompressedSize, int encoding, qint64 compressedSize)
Creates a new zip file entry.
Definition: kzip.cpp:1318
virtual bool finishWriting(qint64 size)
Call finishWriting after writing the data.
Definition: karchive.cpp:386
static bool seekToNextHeaderToken(QIODevice *dev)
Reads the device forwards from the current pos until a token for a central or local header has been f...
Definition: kzip.cpp:329
Definition: ksycocafactory.h:28
A class for reading and writing compressed data onto a device (e.g.
Definition: kfilterdev.h:37
QIODevice::OpenMode mode() const
Returns the mode in which the archive was opened.
Definition: karchive.cpp:470
const QString & path() const
Name with complete path - KArchiveFile::name() is the filename only (no path)
Definition: kzip.cpp:1370
virtual QIODevice * createDevice() const
This method returns a QIODevice to read the file contents.
Definition: kzip.cpp:1386
virtual bool doWriteDir(const QString &name, const QString &user, const QString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)
Reimplemented from KArchive.
Definition: kzip.cpp:1004
static bool parseInfoZipUnixOld(const char *buffer, int size, bool islocal, ParseFileInfo &pfi)
updates the parse information with the given Info-ZIP Unix old extra field.
Definition: kzip.cpp:179
virtual bool writeData(const char *data, qint64 size)
Write data to a file that has been created using prepareWriting().
Definition: kzip.cpp:1262
virtual ~KZip()
If the zip file is still opened, then it will be closed automatically by the destructor.
Definition: kzip.cpp:405
virtual bool openArchive(QIODevice::OpenMode mode)
Opens the archive for reading.
Definition: kzip.cpp:413
Compression compression() const
The current compression mode that will be used for new files.
Definition: kzip.cpp:1284
KArchiveDirectory * findOrCreate(const QString &path)
Ensures that path exists, create otherwise.
Definition: karchive.cpp:406
qint64 position() const
Position of the data in the [uncompressed] archive.
Definition: karchive.cpp:620
static bool parseExtTimestamp(const char *buffer, int size, bool islocal, ParseFileInfo &pfi)
updates the parse information with the given extended timestamp extra field.
Definition: kzip.cpp:119
void setHeaderStart(qint64 headerstart)
Header start: only used when writing.
Definition: kzip.cpp:1350
virtual bool isDirectory() const
Checks whether the entry is a directory.
Definition: karchive.cpp:581
const KArchiveEntry * entry(const QString &name) const
Returns the entry with the given name.
Definition: karchive.cpp:721
ExtraField extraField() const
The current type of "extra field" that will be used for new files.
Definition: kzip.cpp:1294
ExtraField
Describes the contents of the "extra field" for a given file in the Zip archive.
Definition: kzip.h:74
A readonly device that reads from an underlying device from a given point to another (e....
Definition: klimitediodevice_p.h:32
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 27 2020 00:00:00 by doxygen 1.8.20 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 27 2020 00:00:00 by doxygen 1.8.20 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.