KDE 5.0 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

KCompressionDevice Class Reference

from PyKDE5.karchive import *

Inherits: QIODevice → QObject
Subclasses: KFilterDev

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).

Use this class to read/write compressed files.


Enumerations

CompressionType { GZip, BZip2, Xz, None }

Methods

 __init__ (self, QIODevice inputDevice, bool autoDeleteInputDevice, KCompressionDevice::CompressionType type)
 __init__ (self, QString fileName, KCompressionDevice::CompressionType type)
bool atEnd (self)
 close (self)
KCompressionDevice::CompressionType compressionType (self)
KFilterBase filterBase (self)
bool open (self, QIODevice::OpenMode mode)
long readData (self, QString data, long maxlen)
bool seek (self, long a0)
 setOrigFileName (self, QByteArray fileName)
 setSkipHeaders (self)
long writeData (self, QString data, long len)

Static Methods

KFilterBase filterForCompressionType (KCompressionDevice::CompressionType type)

Method Documentation

__init__ (  self,
QIODevice  inputDevice,
bool  autoDeleteInputDevice,
KCompressionDevice::CompressionType  type
)

Constructs a KCompressionDevice for a given CompressionType (e.g. GZip, BZip2 etc.).

Parameters:
inputDevice  input device.
autoDeleteInputDevice  if true, inputDevice will be deleted automatically
type  the CompressionType to use.

__init__ (  self,
QString  fileName,
KCompressionDevice::CompressionType  type
)

Constructs a KCompressionDevice for a given CompressionType (e.g. GZip, BZip2 etc.).

Parameters:
fileName  the name of the file to filter.
type  the CompressionType to use.

bool atEnd (   self )
close (   self )

Close after reading or writing.

KCompressionDevice::CompressionType compressionType (   self )

The compression actually used by this device. If the support for the compression requested in the constructor is not available, then the device will use None.

KFilterBase filterBase (   self )
bool open (  self,
QIODevice::OpenMode  mode
)

Open for reading or writing.

long readData (  self,
QString  data,
long  maxlen
)
bool seek (  self,
long  a0
)

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

setOrigFileName (  self,
QByteArray  fileName
)

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

Parameters:
fileName  the name of the original file

setSkipHeaders (   self )

Call this let this device skip the gzip headers when reading/writing. This way KCompressionDevice (with gzip filter) can be used as a direct wrapper around zlib - this is used by KZip.

long writeData (  self,
QString  data,
long  len
)

Static Method Documentation

KFilterBase filterForCompressionType ( KCompressionDevice::CompressionType  type
)

Call this to create the appropriate filter for the CompressionType named type.

Parameters:
type  the type of the compression filter

Returns:
the filter for the type, or 0 if not found


Enumeration Documentation

CompressionType
Enumerator:
GZip 
BZip2 
Xz 
None 

  • Full Index

Modules

  • karchive
  • kcoreaddons
  • kguiaddons
  • kitemmodels
  • kitemviews
  • kplotting
  • kwidgetsaddons
  • solid
  • sonnet
This documentation is maintained by Simon Edwards.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal