• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KIO

KTar Class Reference

#include <ktar.h>

Inheritance diagram for KTar:

Inheritance graph
[legend]

List of all members.


Detailed Description

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 or bzip2.

Author:
Torben Weis <weis@kde.org>, David Faure <faure@kde.org>

Definition at line 32 of file ktar.h.


Public Member Functions

 KTar (QIODevice *dev)
 KTar (const QString &filename, const QString &mimetype=QString())
void setOrigFileName (const QByteArray &fileName)
virtual ~KTar ()

Protected Member Functions

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)

Constructor & Destructor Documentation

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" or "application/x-bzip" 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 69 of file ktar.cpp.

KTar::KTar ( QIODevice *  dev  )  [explicit]

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 75 of file ktar.cpp.

KTar::~KTar (  )  [virtual]

If the tar ball is still opened, then it will be closed automatically by the destructor.

Definition at line 159 of file ktar.cpp.


Member Function Documentation

bool KTar::closeArchive (  )  [protected, virtual]

Closes the archive.

Called by close.

Implements KArchive.

Definition at line 532 of file ktar.cpp.

bool KTar::createDevice ( QIODevice::OpenMode  mode  )  [protected, virtual]

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 82 of file ktar.cpp.

bool KTar::doFinishWriting ( qint64  size  )  [protected, virtual]

Reimplemented from KArchive.

Implements KArchive.

Definition at line 550 of file ktar.cpp.

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 
) [protected, virtual]

Reimplemented from KArchive.

Implements KArchive.

Definition at line 670 of file ktar.cpp.

bool KTar::doWriteDir ( const QString &  name,
const QString &  user,
const QString &  group,
mode_t  perm,
time_t  atime,
time_t  mtime,
time_t  ctime 
) [protected, virtual]

Reimplemented from KArchive.

Implements KArchive.

Definition at line 735 of file ktar.cpp.

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 
) [protected, virtual]

Reimplemented from KArchive.

Implements KArchive.

Definition at line 793 of file ktar.cpp.

bool KTar::openArchive ( QIODevice::OpenMode  mode  )  [protected, virtual]

Opens the archive for reading.

Parses the directory listing of the archive and creates the KArchiveDirectory/KArchiveFile entries.

Parameters:
mode the mode of the file

Implements KArchive.

Definition at line 332 of file ktar.cpp.

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 169 of file ktar.cpp.

void KTar::virtual_hook ( int  id,
void *  data 
) [protected, virtual]

Reimplemented from KArchive.

Definition at line 848 of file ktar.cpp.


The documentation for this class was generated from the following files:
  • ktar.h
  • ktar.cpp

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal