org.kde.koala

Class KFilterDev

public class KFilterDev extends QIODevice

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.

Author: David Faure

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

Constructor Summary
protected KFilterDev(Class dummy)
KFilterDev(KFilterBase filter, boolean autoDeleteFilterBase)
Constructs a KFilterDev for a given filter (e.g. gzip, bzip2 etc.).
KFilterDev(KFilterBase filter)
Method Summary
longat()
booleanat(long arg1)
That one can be quite slow, when going back.
booleanatEnd()
voidclose()
Close after reading or writing.
static QIODeviceInterfacedevice(QIODeviceInterface inDevice, String mimetype)
Creates an i/o device that is able to read from the QIODevice inDevice, whether the data is compressed or not.
static QIODeviceInterfacedevice(QIODeviceInterface inDevice, String mimetype, boolean autoDeleteInDevice)
Creates an i/o device that is able to read from the QIODevice inDevice, whether the data is compressed or not.
static QIODeviceInterfacedeviceForFile(String fileName, String mimetype, boolean forceFilter)
Creates an i/o device that is able to read from fileName, whether it's compressed or not.
static QIODeviceInterfacedeviceForFile(String fileName, String mimetype)
static QIODeviceInterfacedeviceForFile(String fileName)
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
protected voidfinalize()
Deletes the wrapped C++ instance
voidflush()
intgetch()
booleanisDisposed()
Has the wrapped C++ instance been deleted?
booleanopen(int mode)
Open for reading or writing.
intputch(int arg1)
longreadBlock(StringBuffer data, long maxlen)
voidsetOrigFileName(String fileName)
For writing gzip compressed files only: set the name of the original file, to be used in the gzip header.
voidsetSkipHeaders()
Call this let this device skip the gzip headers when reading/writing.
longsize()
intungetch(int arg1)
longwriteBlock(String data, long len)

Constructor Detail

KFilterDev

protected KFilterDev(Class dummy)

KFilterDev

public KFilterDev(KFilterBase filter, boolean autoDeleteFilterBase)
Constructs a KFilterDev for a given filter (e.g. gzip, bzip2 etc.).

Parameters: filter the KFilterBase to use autoDeleteFilterBase when true this object will become the owner of filter.

UNKNOWN: Constructs a KFilterDev for a given filter (e.

KFilterDev

public KFilterDev(KFilterBase filter)

Method Detail

at

public long at()

at

public boolean at(long arg1)
That one can be quite slow, when going back. Use with care.

UNKNOWN: That one can be quite slow, when going back.

atEnd

public boolean atEnd()

close

public void close()
Close after reading or writing. If the KFilterBase's device was opened by open(), it will be closed.

UNKNOWN: Close after reading or writing.

device

public static QIODeviceInterface device(QIODeviceInterface inDevice, String mimetype)
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.

Parameters: inDevice input device, becomes owned by this device! Automatically deleted! mimetype the mime type for the filter

Returns: a QIODevice that filters the original stream. Must be deleted after using

UNKNOWN: Creates an i/o device that is able to read from the QIODevice inDevice, whether the data is compressed or not.

device

public static QIODeviceInterface device(QIODeviceInterface inDevice, String mimetype, boolean autoDeleteInDevice)
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.

Parameters: inDevice input device. Won't be deleted if autoDeleteInDevice = false mimetype the mime type for the filter autoDeleteInDevice if true, inDevice will be deleted automatically

Returns: a QIODevice that filters the original stream. Must be deleted after using

UNKNOWN: Creates an i/o device that is able to read from the QIODevice inDevice, whether the data is compressed or not.

deviceForFile

public static QIODeviceInterface deviceForFile(String fileName, String mimetype, boolean forceFilter)
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.

Parameters: fileName the name of the file to filter mimetype the mime type of the file to filter, or null if unknown forceFilter if true, the function will either find a compression filter, or return 0. If false, it will always return a QIODevice. If no filter is available it will return a simple QFile. This can be useful if the file is usable without a filter.

Returns: if a filter has been found, the QIODevice for the filter. If the filter does not exist, the return value depends on forceFilter. The returned QIODevice has to be deleted after using.

UNKNOWN: Creates an i/o device that is able to read from fileName, whether it's compressed or not.

deviceForFile

public static QIODeviceInterface deviceForFile(String fileName, String mimetype)

deviceForFile

public static QIODeviceInterface deviceForFile(String fileName)

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()

finalize

protected void finalize()
Deletes the wrapped C++ instance

flush

public void flush()

getch

public int getch()

isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?

open

public boolean open(int mode)
Open for reading or writing. If the KFilterBase's device is not opened, it will be opened.

UNKNOWN: Open for reading or writing.

putch

public int putch(int arg1)

readBlock

public long readBlock(StringBuffer data, long maxlen)

setOrigFileName

public void setOrigFileName(String 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

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

setSkipHeaders

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

UNKNOWN: Call this let this device skip the gzip headers when reading/writing.

size

public long size()

ungetch

public int ungetch(int arg1)

writeBlock

public long writeBlock(String data, long len)