org.kde.koala

Class KTar

public class KTar extends KArchive

A class for reading / writing (optionally compressed) tar archives. KTar allows you to read and write tar archives, including those that are compressed using gzip or bzip2.

Author: Torben Weis , David Faure

UNKNOWN: A class for reading / writing (optionally compressed) tar archives.

Constructor Summary
protected KTar(Class dummy)
KTar(String filename, String mimetype)
Creates an instance that operates on the given filename using the compression filter associated to given mimetype.
KTar(String filename)
KTar(QIODeviceInterface dev)
Creates an instance that operates on the given device.
Method Summary
protected booleancloseArchive()
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
booleandoneWriting(int size)
StringfileName()
The name of the tar file, as passed to the constructor Null if you used the QIODevice constructor.
protected voidfinalize()
Deletes the wrapped C++ instance
booleanisDisposed()
Has the wrapped C++ instance been deleted?
protected booleanopenArchive(int mode)
Opens the archive for reading.
booleanprepareWriting(String name, String user, String group, int size)
booleanprepareWriting(String name, String user, String group, int size, long perm, int atime, int mtime, int ctime)
protected booleanprepareWriting_impl(String name, String user, String group, int size, long perm, int atime, int mtime, int ctime)
voidsetOrigFileName(String fileName)
Special function for setting the "original file name" in the gzip header, when writing a tar.gz file.
booleanwriteDir(String name, String user, String group)
booleanwriteDir(String name, String user, String group, long perm, int atime, int mtime, int ctime)
protected booleanwriteDir_impl(String name, String user, String group, long perm, int atime, int mtime, int ctime)
booleanwriteSymLink(String name, String target, String user, String group, long perm, int atime, int mtime, int ctime)
protected booleanwriteSymLink_impl(String name, String target, String user, String group, long perm, int atime, int mtime, int ctime)

Constructor Detail

KTar

protected KTar(Class dummy)

KTar

public KTar(String filename, String mimetype)
Creates an instance that operates on the given filename using the compression filter associated to given mimetype.

Parameters: filename is a local path (e.g. "/home/weis/myfile.tgz") mimetype "application/x-gzip" or "application/x-bzip2" Do not use application/x-tgz or similar - you only need to specify the compression layer ! If the mimetype is omitted, it will be determined from the filename.

UNKNOWN: Creates an instance that operates on the given filename using the compression filter associated to given mimetype.

KTar

public KTar(String filename)

KTar

public KTar(QIODeviceInterface dev)
Creates an instance that operates on the given device. The device can be compressed (KFilterDev) or not (QFile, etc.).

Parameters: dev the device to read from. If the source is compressed, the QIODevice must take care of decompression

UNKNOWN: Do not assume that giving a QFile here will decompress the file, in case it's compressed! Creates an instance that operates on the given device.

Method Detail

closeArchive

protected boolean closeArchive()

dispose

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

doneWriting

public boolean doneWriting(int size)

fileName

public String fileName()
The name of the tar file, as passed to the constructor Null if you used the QIODevice constructor.

Returns: the name of the file, or null if unknown

UNKNOWN: The name of the tar file, as passed to the constructor Null if you used the QIODevice constructor.

finalize

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

isDisposed

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

openArchive

protected boolean openArchive(int mode)
Opens the archive for reading. Parses the directory listing of the archive and creates the KArchiveDirectory/KArchiveFile entries.

Parameters: mode the mode of the file

UNKNOWN: Opens the archive for reading.

prepareWriting

public boolean prepareWriting(String name, String user, String group, int size)

prepareWriting

public boolean prepareWriting(String name, String user, String group, int size, long perm, int atime, int mtime, int ctime)

prepareWriting_impl

protected boolean prepareWriting_impl(String name, String user, String group, int size, long perm, int atime, int mtime, int ctime)

setOrigFileName

public void setOrigFileName(String fileName)
Special function for setting the "original file name" in the gzip header, when writing a tar.gz file. It appears when using in the "file" command, for instance. Should only be called if the underlying device is a KFilterDev!

Parameters: fileName the original file name

UNKNOWN: Special function for setting the "original file name" in the gzip header, when writing a tar.

writeDir

public boolean writeDir(String name, String user, String group)

writeDir

public boolean writeDir(String name, String user, String group, long perm, int atime, int mtime, int ctime)

writeDir_impl

protected boolean writeDir_impl(String name, String user, String group, long perm, int atime, int mtime, int ctime)

writeSymLink

public boolean writeSymLink(String name, String target, String user, String group, long perm, int atime, int mtime, int ctime)

writeSymLink_impl

protected boolean writeSymLink_impl(String name, String target, String user, String group, long perm, int atime, int mtime, int ctime)