KDECore
ktar.cpp
Go to the documentation of this file.
107 if (mime->is(QString::fromLatin1("application/x-compressed-tar")) || mime->is(QString::fromLatin1(application_gzip))) {
110 } else if (mime->is(QString::fromLatin1("application/x-bzip-compressed-tar")) || mime->is(QString::fromLatin1(application_bzip))) {
113 } else if (mime->is(QString::fromLatin1("application/x-lzma-compressed-tar")) || mime->is(QString::fromLatin1(application_lzma))) {
116 } else if (mime->is(QString::fromLatin1("application/x-xz-compressed-tar")) || mime->is(QString::fromLatin1(application_xz))) {
200 // Some tars right-justify the checksum so it could start in one of three places - we have to check each.
288 if ( QLatin1String(application_gzip) == mimetype || QLatin1String(application_bzip) == mimetype )
413 //kDebug(7041) << nm << "isdir=" << isdir << "pos=" << dev->pos() << "typeflag=" << typeflag << " islink=" << ( typeflag == '1' || typeflag == '2' );
416 // Skip it for now. TODO: implement reading of extended header, as per http://pubs.opengroup.org/onlinepubs/009695399/utilities/pax.html
509 if (QLatin1String(application_gzip) == mimetype || QLatin1String(application_bzip) == mimetype ||
typedef OpenMode
static QIODevice * deviceForFile(const QString &fileName, const QString &mimetype=QString(), bool forceFilter=false)
Reimplemented to return true.
Definition: kfilterdev.cpp:64
bool flush()
KTar(const QString &filename, const QString &mimetype=QString())
Creates an instance that operates on the given filename using the compression filter associated to gi...
Definition: ktar.cpp:74
virtual bool seek(qint64 pos)
void truncate(int position)
virtual KArchiveDirectory * rootDir()
Retrieves or create the root directory.
Definition: karchive.cpp:391
virtual bool atEnd() const
QByteArray trimmed() const
virtual bool createDevice(QIODevice::OpenMode mode)
Can be reimplemented in order to change the creation of the device (when using the fileName construct...
Definition: karchive.cpp:131
virtual bool seek(qint64 pos)
Definition: kmacroexpander_unix.cpp:34
static Ptr findByPath(const QString &path, mode_t mode=0, bool fast_mode=false, int *accuracy=0)
Finds a KMimeType with the given url.
Definition: kmimetype.cpp:329
virtual ~KTar()
If the tar ball is still opened, then it will be closed automatically by the destructor.
Definition: ktar.cpp:158
A QTemporaryFile that will save in the KDE temp directory.
Definition: ktemporaryfile.h:92
int length() const
bool exists() const
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
virtual void close()
static KMimeType::Ptr defaultMimeTypePtr()
Returns the default mimetype.
Definition: kmimetype.cpp:43
QIODevice::OpenMode mode() const
Returns the mode in which the archive was opened.
Definition: karchive.cpp:470
virtual qint64 pos() const
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
void resize(int size)
virtual bool createDevice(QIODevice::OpenMode mode)
Can be reimplemented in order to change the creation of the device (when using the fileName construct...
Definition: ktar.cpp:87
QString fromLocal8Bit(const char *str, int size)
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: ktar.cpp:748
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
A class for reading and writing compressed data onto a device (e.g.
Definition: kfilterdev.h:36
bool isEmpty() const
const char * constData() const
QByteArray number(int n, int base)
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
qint64 read(char *data, qint64 maxSize)
bool isOpen() const
void setOrigFileName(const QByteArray &fileName)
Special function for setting the "original file name" in the gzip header, when writing a tar...
Definition: ktar.cpp:168
OpenMode openMode() const
QByteArray toLocal8Bit() const
virtual void close()
qlonglong toLongLong(bool *ok, int base) const
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
QString cleanPath(const QString &path)
KArchiveDirectory * findOrCreate(const QString &path)
Ensures that path exists, create otherwise.
Definition: karchive.cpp:406
virtual bool openArchive(QIODevice::OpenMode mode)
Opens the archive for reading.
Definition: ktar.cpp:332
QString mid(int position, int n) const
virtual bool atEnd() const
int length() const
char * data()
void setRootDir(KArchiveDirectory *rootDir)
Derived classes call setRootDir from openArchive, to set the root directory after parsing an existing...
Definition: karchive.cpp:464
QString left(int n) const
qint64 write(const char *data, qint64 maxSize)
QString fromLatin1(const char *str, int size)
void setDevice(QIODevice *dev)
Can be called by derived classes in order to set the underlying device.
Definition: karchive.cpp:456
static Ptr findByFileContent(const QString &fileName, int *accuracy=0)
Tries to find out the MIME type of a file by looking for certain magic numbers and characteristic str...
Definition: kmimetype.cpp:375
QByteArray rightJustified(int width, char fill, bool truncate) const
int size() const
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: ktar.cpp:806
QByteArray encodeName(const QString &fileName)
QString decodeName(const QByteArray &localFileName)
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: ktar.cpp:683
bool is(const QString &mimeTypeName) const
Do not use name()=="somename" anymore, to check for a given mimetype.
Definition: kmimetype.cpp:556
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.