#include <ktar.h>
|
| KTar (const QString &filename, const QString &mimetype=QString()) |
|
| KTar (QIODevice *dev) |
|
virtual | ~KTar () |
|
void | setOrigFileName (const QByteArray &fileName) |
|
virtual | ~KArchive () |
|
bool | addLocalDirectory (const QString &path, const QString &destName) |
|
bool | addLocalFile (const QString &fileName, const QString &destName) |
|
virtual bool | close () |
|
QIODevice * | device () const |
|
const KArchiveDirectory * | directory () const |
|
QString | fileName () const |
|
virtual bool | finishWriting (qint64 size) |
|
bool | isOpen () const |
|
QIODevice::OpenMode | mode () const |
|
virtual bool | open (QIODevice::OpenMode mode) |
|
virtual bool | prepareWriting (const QString &name, const QString &user, const QString &group, qint64 size, mode_t perm=0100644, time_t atime=UnknownTime, time_t mtime=UnknownTime, time_t ctime=UnknownTime) |
|
virtual bool | writeData (const char *data, qint64 size) |
|
virtual bool | writeDir (const QString &name, const QString &user, const QString &group, mode_t perm=040755, time_t atime=UnknownTime, time_t mtime=UnknownTime, time_t ctime=UnknownTime) |
|
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) |
|
virtual bool | writeSymLink (const QString &name, const QString &target, const QString &user, const QString &group, mode_t perm=0120755, time_t atime=UnknownTime, time_t mtime=UnknownTime, time_t ctime=UnknownTime) |
|
|
virtual bool | closeArchive () |
|
virtual bool | createDevice (QIODevice::OpenMode mode) |
|
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) |
|
| KArchive (const QString &fileName) |
|
| KArchive (QIODevice *dev) |
|
KArchiveDirectory * | findOrCreate (const QString &path) |
|
virtual KArchiveDirectory * | rootDir () |
|
void | setDevice (QIODevice *dev) |
|
void | setRootDir (KArchiveDirectory *rootDir) |
|
A class for reading / writing (optionally compressed) tar archives.
KTar allows you to read and write tar archives, including those that are compressed using gzip, bzip2 or xz.
- Author
- Torben Weis weis@.nosp@m.kde..nosp@m.org, David Faure faure.nosp@m.@kde.nosp@m..org
Definition at line 32 of file ktar.h.
◆ KTar() [1/2]
KTar::KTar |
( |
const QString & |
filename, |
|
|
const QString & |
mimetype = QString() |
|
) |
| |
|
explicit |
Creates an instance that operates on the given filename using the compression filter associated to given mimetype.
- Parameters
-
filename | is a local path (e.g. "/home/weis/myfile.tgz") |
mimetype | "application/x-gzip", "application/x-bzip" or "application/x-xz" Do not use application/x-compressed-tar or similar - you only need to specify the compression layer ! If the mimetype is omitted, it will be determined from the filename. |
Definition at line 74 of file ktar.cpp.
◆ KTar() [2/2]
Creates an instance that operates on the given device.
The device can be compressed (KFilterDev) or not (QFile, etc.).
- Warning
- Do not assume that giving a QFile here will decompress the file, in case it's compressed!
- Parameters
-
dev | the device to read from. If the source is compressed, the QIODevice must take care of decompression |
Definition at line 80 of file ktar.cpp.
◆ ~KTar()
If the tar ball is still opened, then it will be closed automatically by the destructor.
Definition at line 158 of file ktar.cpp.
◆ closeArchive()
bool KTar::closeArchive |
( |
| ) |
|
|
protectedvirtual |
Closes the archive.
Called by close.
Implements KArchive.
Definition at line 545 of file ktar.cpp.
◆ createDevice()
bool KTar::createDevice |
( |
QIODevice::OpenMode |
mode | ) |
|
|
protectedvirtual |
Can be reimplemented in order to change the creation of the device (when using the fileName constructor).
By default this method uses KSaveFile when saving, and a simple QFile on reading. This method is called by open().
Reimplemented from KArchive.
Definition at line 87 of file ktar.cpp.
◆ doFinishWriting()
bool KTar::doFinishWriting |
( |
qint64 |
size | ) |
|
|
protectedvirtual |
◆ doPrepareWriting()
bool KTar::doPrepareWriting |
( |
const QString & |
name, |
|
|
const QString & |
user, |
|
|
const QString & |
group, |
|
|
qint64 |
size, |
|
|
mode_t |
perm, |
|
|
time_t |
atime, |
|
|
time_t |
mtime, |
|
|
time_t |
ctime |
|
) |
| |
|
protectedvirtual |
◆ doWriteDir()
bool KTar::doWriteDir |
( |
const QString & |
name, |
|
|
const QString & |
user, |
|
|
const QString & |
group, |
|
|
mode_t |
perm, |
|
|
time_t |
atime, |
|
|
time_t |
mtime, |
|
|
time_t |
ctime |
|
) |
| |
|
protectedvirtual |
◆ doWriteSymLink()
bool KTar::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 |
|
) |
| |
|
protectedvirtual |
◆ openArchive()
bool KTar::openArchive |
( |
QIODevice::OpenMode |
mode | ) |
|
|
protectedvirtual |
Opens the archive for reading.
Parses the directory listing of the archive and creates the KArchiveDirectory/KArchiveFile entries.
- Parameters
-
Implements KArchive.
Definition at line 332 of file ktar.cpp.
◆ setOrigFileName()
void KTar::setOrigFileName |
( |
const QByteArray & |
fileName | ) |
|
Special function for setting the "original file name" in the gzip header, when writing a tar.gz file.
It appears when using in the "file" command, for instance. Should only be called if the underlying device is a KFilterDev!
- Parameters
-
fileName | the original file name |
Definition at line 168 of file ktar.cpp.
◆ virtual_hook()
void KTar::virtual_hook |
( |
int |
id, |
|
|
void * |
data |
|
) |
| |
|
protectedvirtual |
The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Feb 3 2022 00:00:00 by
doxygen 1.9.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.