# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KAr Class Reference

A class for reading ar archives. More...

`#include <kar.h>`

Inheritance diagram for KAr:

[legend]
Collaboration diagram for KAr:

[legend]
List of all members.

## Public Member Functions

| KAr (const QString &filename)
| Creates an instance that operates on the given filename.
| KAr (QIODevice *dev)
| Creates an instance that operates on the given device.
virtual | ~KAr ()
| If the ar file is still opened, then it will be closed automatically by the destructor.
QString | fileName ()
| The name of the ar file, as passed to the constructor Null if you used the QIODevice constructor.
virtual bool | prepareWriting (const QString &, const QString &, const QString &, uint)
| 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.
virtual bool | doneWriting (uint)
| Call doneWriting after writing the data.
virtual bool | writeDir (const QString &, const QString &, const QString &)
| If an archive is opened for writing then you can add new directories using this function.

## Protected Member Functions

virtual bool | openArchive (int mode)
| Opens the archive for reading.
virtual bool | closeArchive ()
| Closes the archive.
virtual void | virtual_hook (int id, void *data)

## Detailed Description

A class for reading ar archives.

Author:
  Laurence Anderson <l.d.anderson@warwick.ac.uk>

Since:
  3.1

Definition at line 36 of file kar.h.

## Constructor & Destructor Documentation

KAr::KAr | ( | const QString & | filename | ) |

Creates an instance that operates on the given filename.

Parameters:

  filename | is a local path (e.g. "/home/holger/myfile.ar")

Definition at line 42 of file kar.cpp.

KAr::KAr | ( | QIODevice * | dev | ) |

| Creates an instance that operates on the given device. The device can be compressed (KFilterDev) or not (QFile, etc.). Definition at line 51 of file kar.cpp.

KAr::~KAr | ( |  | ) | `[virtual]`

| If the ar file is still opened, then it will be closed automatically by the destructor. Definition at line 58 of file kar.cpp. References KArchive::close(), KArchive::device(), QString::isEmpty(), and KArchive::isOpened().

## Member Function Documentation

QString KAr::fileName | ( |  | ) | `[inline]`

| The name of the ar file, as passed to the constructor Null if you used the QIODevice constructor. Definition at line 62 of file kar.h.

virtual bool KAr::prepareWriting | ( | const QString & | ,
|  | const QString & | ,
|  | const QString & | ,
|  | uint |
| ) | `[inline, 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.

Definition at line 67 of file kar.h.

virtual bool KAr::doneWriting | ( | uint |  | ) | `[inline, virtual]`

Call doneWriting after writing the data.

See also:
  prepareWriting

Implements KArchive.

Definition at line 68 of file kar.h.

virtual bool KAr::writeDir | ( | const QString & | ,
|  | const QString & | ,
|  | const QString & |
| ) | `[inline, 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. Definition at line 69 of file kar.h.

bool KAr::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.

Definition at line 69 of file kar.cpp.

References KArchiveDirectory::addEntry(), QIODevice::at(), QIODevice::atEnd(), KArchive::device(), QString::find(), QString::left(), QString::mid(), QCString::mid(), KStdAccel::name(), QIODevice::readBlock(), QString::replace(), QCString::resize(), QCString::right(), KArchive::rootDir(), and QString::stripWhiteSpace().

bool KAr::closeArchive | ( |  | ) | `[protected, virtual]`

| Closes the archive. Called by close. Implements KArchive. Definition at line 161 of file kar.cpp.

The documentation for this class was generated from the following files:

- kar.h
- kar.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:14:57 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001