KDE 4.2 PyKDE API Reference

- KDE's Python API

# KTar Class Reference

`from PyKDE4.kio import *`

Inherits: KArchive

## 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>

## Methods

| __init__ (self, QString filename, QString mimetype=QString())
| __init__ (self, QIODevice dev)
| __init__ (self, KTar other)
bool | closeArchive (self)
bool | createDevice (self, QIODevice.OpenMode mode)
bool | doFinishWriting (self, long size)
bool | doPrepareWriting (self, QString name, QString user, QString group, long size, mode_t perm, time_t atime, time_t mtime, time_t ctime)
bool | doWriteDir (self, QString name, QString user, QString group, mode_t perm, time_t atime, time_t mtime, time_t ctime)
bool | doWriteSymLink (self, QString name, QString target, QString user, QString group, mode_t perm, time_t atime, time_t mtime, time_t ctime)
bool | openArchive (self, QIODevice.OpenMode mode)
| setOrigFileName (self, QByteArray fileName)
| virtual_hook (self, int id, void data)

## Method Documentation

__init__ | ( | self, |
|  | QString | filename,
|  | QString | mimetype=QString()
| ) |  |  |

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.

__init__ | ( | self, |
|  | QIODevice | dev
| ) |  |  |

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

__init__ | ( | self, |
|  | KTar | other
| ) |  |  |

bool closeArchive | ( |  | self ) |

bool createDevice | ( | self, |
|  | QIODevice.OpenMode | mode
| ) |  |  |

bool doFinishWriting | ( | self, |
|  | long | size
| ) |  |  |

Reimplemented from KArchive

bool doPrepareWriting | ( | self, |
|  | QString | name,
|  | QString | user,
|  | QString | group,
|  | long | size,
|  | mode_t | perm,
|  | time_t | atime,
|  | time_t | mtime,
|  | time_t | ctime
| ) |  |  |

Reimplemented from KArchive

bool doWriteDir | ( | self, |
|  | QString | name,
|  | QString | user,
|  | QString | group,
|  | mode_t | perm,
|  | time_t | atime,
|  | time_t | mtime,
|  | time_t | ctime
| ) |  |  |

Reimplemented from KArchive

bool doWriteSymLink | ( | self, |
|  | QString | name,
|  | QString | target,
|  | QString | user,
|  | QString | group,
|  | mode_t | perm,
|  | time_t | atime,
|  | time_t | mtime,
|  | time_t | ctime
| ) |  |  |

Reimplemented from KArchive

bool openArchive | ( | self, |
|  | QIODevice.OpenMode | mode
| ) |  |  |

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

setOrigFileName | ( | self, |
|  | 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

virtual_hook | ( | self, |
|  | int | id,
|  | void | data
| ) |  |  |