Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

KTar Class Reference

A class for reading/writing (optionnally compressed) tar archives. More...

#include <ktar.h>

Inheritance diagram for KTar:

KArchive List of all members.

Public Methods

 KTar (const QString &filename, const QString &mimetype=QString::null)
 KTar (QIODevice *dev)
virtual ~KTar ()
QString fileName ()
void setOrigFileName (const QCString &fileName)
virtual bool writeDir (const QString &name, const QString &user, const QString &group)
virtual bool prepareWriting (const QString &name, const QString &user, const QString &group, uint size)
virtual bool doneWriting (uint size)

Protected Methods

virtual bool openArchive (int mode)
virtual bool closeArchive ()
virtual void virtual_hook (int id, void *data)

Detailed Description

A class for reading/writing (optionnally compressed) tar archives.

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

Definition at line 35 of file ktar.h.


Constructor & Destructor Documentation

KTar::KTar const QString &    filename,
const QString &    mimetype = QString::null
 

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-bzip2" Do not use application/x-tgz or so. Only the compression layer ! If the mimetype is ommitted, it will be determined from the filename.

KTar::KTar QIODevice *    dev
 

Creates an instance that operates on the given device. The device can be compressed (KFilterDev) or not (QFile, etc.). WARNING: don't assume that giving a QFile here will decompress the file, in case it's compressed!

virtual KTar::~KTar   [virtual]
 

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


Member Function Documentation

virtual bool KTar::closeArchive   [protected, virtual]
 

Closes the archive. Called by close.

Implements KArchive.

virtual bool KTar::doneWriting uint    size [virtual]
 

Call doneWriting after writing the data.

See also:
prepareWriting

Implements KArchive.

QString KTar::fileName   [inline]
 

The name of the tar file, as passed to the constructor Null if you used the QIODevice constructor.

Definition at line 67 of file ktar.h.

virtual bool KTar::openArchive int    mode [protected, virtual]
 

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

Implements KArchive.

virtual bool KTar::prepareWriting const QString &    name,
const QString &    user,
const QString &    group,
uint    size
[virtual]
 

Here's another way of writing a file into an archive: Call prepareWriting, then call device()->writeBlock() (for tar files) or writeData (for zip files) [NEW VIRTUAL METHOD NEEDED] as many times as wanted then call doneWriting( totalSize ) For tar.gz files, you need to know the size before hand, it is needed in the header! For zip files, size isn't used.

Implements KArchive.

void KTar::setOrigFileName const QCString &    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!

virtual bool KTar::writeDir const QString &    name,
const QString &    user,
const QString &    group
[virtual]
 

If an archive is opened for writing then you can add new directories using this function. KArchive won't write one directory twice.

Implements KArchive.


The documentation for this class was generated from the following file:
Generated on Wed Aug 13 23:30:26 2003 for kdelibs by doxygen1.2.18