class KFilterDev

A class for reading and writing compressed data onto a device (e. More...

Definition#include <kfilterdev.h>
InheritsQIODevice (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods


Detailed Description

A class for reading and writing compressed data onto a device (e.g. file, but other usages are possible, like a buffer or a socket)

To simply read/write compressed files, see deviceForFile.

 KFilterDev ( KFilterBase * filter, bool autodeleteFilterBase = false)

KFilterDev

Constructs a KFilterDev for a given filter (e.g. gzip, bzip2 etc.)

Parameters:
autoDeleteFilterbasewhen true this object will become the owner of filter.

 ~KFilterDev ()

~KFilterDev

[virtual]

Destructs the KFilterDev.

bool  open ( int mode )

open

[virtual]

void  close ()

close

[virtual]

void  flush ()

flush

[virtual]

void  setOrigFileName ( const QCString & fileName )

setOrigFileName

For writing gzip compressed files only: set the name of the original file, to be used in the gzip header.

QIODevice::Offset  size ()

size

[const virtual]

QIODevice::Offset  at ()

at

[const virtual]

bool  at ( QIODevice::Offset )

at

[virtual]

That one can be quite slow, when going back. Use with care.

bool  atEnd ()

atEnd

[const virtual]

Q_LONG  readBlock ( char *data, Q_ULONG maxlen )

readBlock

[virtual]

Q_LONG  writeBlock ( const char *data, Q_ULONG len )

writeBlock

[virtual]

int  getch ()

getch

[virtual]

int  putch ( int )

putch

[virtual]

int  ungetch ( int )

ungetch

[virtual]

QIODevice*  createFilterDevice (KFilterBase* base, QFile* file)

createFilterDevice

[static]

Call this to create the appropriate filter device for base working on file . The returned QIODevice has to be deleted after using. To be removed in KDE 3.0

QIODevice *  deviceForFile ( const QString & fileName, const QString & mimetype = QString::null, bool forceFilter = false )

deviceForFile

[static]

Creates an i/o device that is able to read from fileName, whether it's compressed or not. Available compression filters (gzip/bzip2 etc.) will automatically be used.

The compression filter to be used is determined from the fileName if mimetype is empty. Pass "application/x-gzip" or "application/x-bzip2" to force the corresponding decompression filter, if available.

Warning: application/x-bzip2 may not be available. In that case a QFile opened on the compressed data will be returned ! Use KFilterBase::findFilterByMimeType and code similar to what deviceForFile is doing, to better control what's happening.

The returned QIODevice has to be deleted after using.

QIODevice *  device ( QIODevice* inDevice, const QString & mimetype)

device

[static]

Creates an i/o device that is able to read from the QIODevice inDevice, whether the data is compressed or not. Available compression filters (gzip/bzip2 etc.) will automatically be used.

The compression filter to be used is determined mimetype . Pass "application/x-gzip" or "application/x-bzip2" to use the corresponding decompression filter.

Warning: application/x-bzip2 may not be available. In that case 0 will be returned !

The returned QIODevice has to be deleted after using.