kio Library API Documentation

KArchiveFile Class Reference

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

#include <karchive.h>

Inheritance diagram for KArchiveFile:

KArchiveEntry List of all members.

Public Methods

 KArchiveFile (KArchive *archive, const QString &name, int access, int date, const QString &user, const QString &group, const QString &symlink, int pos, int size)
virtual ~KArchiveFile ()
int position () const
int size () const
void setSize (int s)
virtual QByteArray data () const
QIODevicedevice () const
virtual bool isFile () const
void copyTo (const QString &dest) const

Protected Methods

virtual void virtual_hook (int id, void *data)

Detailed Description

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

See also:
KArchive , KArchiveDirectory

Definition at line 477 of file karchive.h.


Constructor & Destructor Documentation

KArchiveFile::KArchiveFile KArchive   archive,
const QString   name,
int    access,
int    date,
const QString   user,
const QString   group,
const QString   symlink,
int    pos,
int    size
 

Creates a new file entry.

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::null
pos  the position of the file in the directory
size  the size of the file

Definition at line 462 of file karchive.cpp.

References size(), and KIO::symlink().


Member Function Documentation

int KArchiveFile::position   const
 

Position of the data in the [uncompressed] archive.

Returns:
the position of the file

Definition at line 472 of file karchive.cpp.

Referenced by KArchiveDirectory::copyTo().

int KArchiveFile::size   const
 

Size of the data.

Returns:
the size of the file

Definition at line 477 of file karchive.cpp.

Referenced by KArchiveFile().

void KArchiveFile::setSize int    s [inline]
 

Set size of data, usually after writing the file.

Parameters:
s  the new size of the file

Definition at line 512 of file karchive.h.

QByteArray KArchiveFile::data   const [virtual]
 

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.

Definition at line 482 of file karchive.cpp.

References QIODevice::at(), KArchive::device(), and QIODevice::readBlock().

Referenced by copyTo().

QIODevice * KArchiveFile::device   const
 

This method returns QIODevice (internal class: KLimitedIODevice) on top of the underlying QIODevice.

This is obviously for reading only. 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

Definition at line 499 of file karchive.cpp.

virtual bool KArchiveFile::isFile   const [inline, virtual]
 

Checks whether this entry is a file.

Returns:
true, since this entry is a file

Reimplemented from KArchiveEntry.

Definition at line 535 of file karchive.h.

void KArchiveFile::copyTo const QString   dest const
 

Extracts the file to the directory dest.

Parameters:
dest  the directory to extract to
Since:
3.1

Definition at line 504 of file karchive.cpp.

References QFile::close(), data(), KArchiveEntry::name(), and QFile::open().

Referenced by KArchiveDirectory::copyTo().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kio Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun May 16 22:03:28 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003