KDE 4.9 PyKDE API Reference

- KDE's Python API

# KArchiveFile Class Reference

`from PyKDE4.kio import *`

Inherits: KArchiveEntry
Subclasses: KZipFileEntry

## Detailed Description

Represents a file entry in a KArchive. A file in an archive.

See also:
  KArchive

See also:
  KArchiveDirectory

## Methods

| __init__ (self, KArchive archive, QString name, int access, int date, QString user, QString group, QString symlink, long pos, long size)
| __init__ (self, KArchiveFile other)
| copyTo (self, QString dest)
QIODevice | createDevice (self)
QByteArray | data (self)
bool | isFile (self)
long | position (self)
| setSize (self, long s)
long | size (self)

## Method Documentation

__init__ | ( | self, |
|  | KArchive | archive,
|  | QString | name,
|  | int | access,
|  | int | date,
|  | QString | user,
|  | QString | group,
|  | QString | symlink,
|  | long | pos,
|  | long | size
| ) |  |  |

Creates a new file entry. Do not call this, KArchive takes care of it.

Parameters:

  | archive | the entries archive
  | name | the name of the entry
  | access | the permissions in unix format
  | date | the date (in seconds since 1970)
  | user | the user that owns the entry
  | group | the group that owns the entry
  | symlink | the symlink, or QString()
  | pos | the position of the file in the directory
  | size | the size of the file

__init__ | ( | self, |
|  | KArchiveFile | other
| ) |  |  |

copyTo | ( | self, |
|  | QString | dest
| ) |  |  |

Extracts the file to the directory dest

Parameters:

  | dest | the directory to extract to

QIODevice createDevice | ( |  | self ) |

This method returns QIODevice (internal class: KLimitedIODevice) on top of the underlying QIODevice. This is obviously for reading only.

WARNING: Note that the ownership of the device is being transferred to the caller, who will have to delete it.

The returned device auto-opens (in readonly mode), no need to open it.

Returns:
  the QIODevice of the file

QByteArray data | ( |  | self ) |

Returns the data of the file. Call data() with care (only once per file), this data isn't cached.

Returns:
  the content of this file.

bool isFile | ( |  | self ) |

Checks whether this entry is a file.

Returns:
  true, since this entry is a file

long position | ( |  | self ) |

Position of the data in the [uncompressed] archive.

Returns:
  the position of the file

setSize | ( | self, |
|  | long | s
| ) |  |  |

Set size of data, usually after writing the file.

Parameters:

  | s | the new size of the file

long size | ( |  | self ) |

Size of the data.

Returns:
  the size of the file