KArchive 5.109.0
Public Member Functions | List of all members
KZipFileEntry

A KZipFileEntry represents a file in a zip archive. More...

#include <KZipFileEntry>

Public Member Functions

 KZipFileEntry (KZip *zip, const QString &name, int access, const QDateTime &date, const QString &user, const QString &group, const QString &symlink, const QString &path, qint64 start, qint64 uncompressedSize, int encoding, qint64 compressedSize)
 Creates a new zip file entry.
 
 ~KZipFileEntry () override
 Destructor.
 
qint64 compressedSize () const
 
unsigned long crc32 () const
 CRC: only used when writing.
 
QIODevice * createDevice () const override
 This method returns a QIODevice to read the file contents.
 
QByteArray data () const override
 
int encoding () const
 
qint64 headerStart () const
 
const QString & path () const
 Name with complete path - KArchiveFile::name() is the filename only (no path)
 
void setCompressedSize (qint64 compressedSize)
 Only used when writing.
 
void setCRC32 (unsigned long crc32)
 
void setHeaderStart (qint64 headerstart)
 Header start: only used when writing.
 
- Public Member Functions inherited from KArchiveFile
 KArchiveFile (KArchive *archive, const QString &name, int access, const QDateTime &date, const QString &user, const QString &group, const QString &symlink, qint64 pos, qint64 size)
 Creates a new file entry.
 
 ~KArchiveFile () override
 Destructor.
 
bool copyTo (const QString &dest) const
 Extracts the file to the directory dest.
 
virtual QIODevice * createDevice () const
 This method returns QIODevice (internal class: KLimitedIODevice) on top of the underlying QIODevice.
 
virtual QByteArray data () const
 Returns the data of the file.
 
bool isFile () const override
 Checks whether this entry is a file.
 
qint64 position () const
 Position of the data in the [uncompressed] archive.
 
void setSize (qint64 s)
 Set size of data, usually after writing the file.
 
qint64 size () const
 Size of the data.
 
- Public Member Functions inherited from KArchiveEntry
 KArchiveEntry (KArchive *archive, const QString &name, int access, const QDateTime &date, const QString &user, const QString &group, const QString &symlink)
 Creates a new entry.
 
QDateTime date () const
 Creation date of the file.
 
QString group () const
 Group of the user who created the file.
 
virtual bool isDirectory () const
 Checks whether the entry is a directory.
 
virtual bool isFile () const
 Checks whether the entry is a file.
 
QString name () const
 Name of the file without path.
 
mode_t permissions () const
 The permissions and mode flags as returned by the stat() function in st_mode.
 
QString symLinkTarget () const
 Symlink if there is one.
 
QString user () const
 User who created the file.
 

Additional Inherited Members

- Protected Member Functions inherited from KArchiveFile
void virtual_hook (int id, void *data) override
 
- Protected Member Functions inherited from KArchiveEntry
KArchivearchive () const
 
virtual void virtual_hook (int id, void *data)
 

Detailed Description

A KZipFileEntry represents a file in a zip archive.

Constructor & Destructor Documentation

◆ KZipFileEntry()

KZipFileEntry::KZipFileEntry ( KZip zip,
const QString &  name,
int  access,
const QDateTime &  date,
const QString &  user,
const QString &  group,
const QString &  symlink,
const QString &  path,
qint64  start,
qint64  uncompressedSize,
int  encoding,
qint64  compressedSize 
)

Creates a new zip file entry.

Do not call this, KZip takes care of it.

◆ ~KZipFileEntry()

KZipFileEntry::~KZipFileEntry ( )
override

Destructor.

Do not call this.

Member Function Documentation

◆ crc32()

unsigned long KZipFileEntry::crc32 ( ) const

CRC: only used when writing.

◆ createDevice()

QIODevice * KZipFileEntry::createDevice ( ) const
overridevirtual

This method returns a QIODevice to read the file contents.

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.

Reimplemented from KArchiveFile.

◆ data()

QByteArray KZipFileEntry::data ( ) const
overridevirtual
Returns
the content of this file. Call data() with care (only once per file), this data isn't cached.

Reimplemented from KArchiveFile.

◆ path()

const QString & KZipFileEntry::path ( ) const

Name with complete path - KArchiveFile::name() is the filename only (no path)

◆ setCompressedSize()

void KZipFileEntry::setCompressedSize ( qint64  compressedSize)

Only used when writing.

◆ setHeaderStart()

void KZipFileEntry::setHeaderStart ( qint64  headerstart)

Header start: only used when writing.