# class KTar

###

Module | kio
Namespace |
Class | KTar
Inherits | KArchive

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

- KTar (filename, mimetype)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  filename | QString |
  mimetype | QString | QString()

  Creates an instance that operates on the given filename using the compression filter associated to given mimetype.

  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.

- KTar (dev)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  dev | QIODevice |

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

  dev - the device to read from. If the source is compressed, the QIODevice must take care of decompression

- KTar (a0, a1)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QString |
  a1 | QString | QString()

- KTar (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QIODevice |

- closeArchive ( )

  returns bool

- createDevice (mode)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  mode | QIODevice.OpenMode |

- doFinishWriting (size)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  size | qint64 |

  Reimplemented from KArchive

- doPrepareWriting (name, user, group, size, perm, atime, mtime, ctime)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  name | QString |
  user | QString |
  group | QString |
  size | qint64 |
  perm | mode_t |
  atime | time_t |
  mtime | time_t |
  ctime | time_t |

  Reimplemented from KArchive

- doWriteDir (name, user, group, perm, atime, mtime, ctime)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  name | QString |
  user | QString |
  group | QString |
  perm | mode_t |
  atime | time_t |
  mtime | time_t |
  ctime | time_t |

  Reimplemented from KArchive

- doWriteSymLink (name, target, user, group, perm, atime, mtime, ctime)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  name | QString |
  target | QString |
  user | QString |
  group | QString |
  perm | mode_t |
  atime | time_t |
  mtime | time_t |
  ctime | time_t |

  Reimplemented from KArchive

- openArchive (mode)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  mode | QIODevice.OpenMode |

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

  mode - the mode of the file

- setOrigFileName (fileName)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  fileName | QByteArray |

  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!

  fileName - the original file name

- virtual_hook (id, data)

  returns Nothing
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  id | int |
  data | void |