org.kde.koala
Class KAr

java.lang.Object
  extended by org.kde.koala.KArchive
      extended by org.kde.koala.KAr
All Implemented Interfaces:
org.kde.qt.QtSupport

public class KAr
extends KArchive

KAr is a class for reading archives in ar format. Writing is not supported.

Author:
Laurence Anderson

Field Summary
 
Fields inherited from class org.kde.koala.KArchive
VIRTUAL_PREPARE_WRITING, VIRTUAL_WRITE_DATA, VIRTUAL_WRITE_DIR, VIRTUAL_WRITE_FILE, VIRTUAL_WRITE_SYMLINK
 
Constructor Summary
protected KAr(java.lang.Class dummy)
           
  KAr(org.kde.qt.QIODeviceInterface dev)
          Creates an instance that operates on the given device.
  KAr(java.lang.String filename)
          Creates an instance that operates on the given filename.
 
Method Summary
protected  boolean closeArchive()
           
 void dispose()
          Delete the wrapped C++ instance ahead of finalize()
 boolean doneWriting(int size)
          Call doneWriting after writing the data.
 java.lang.String fileName()
          The name of the ar file, as passed to the constructor.
protected  void finalize()
          Deletes the wrapped C++ instance
 boolean isDisposed()
          Has the wrapped C++ instance been deleted?
protected  boolean openArchive(int mode)
          Opens the archive for reading.
 boolean prepareWriting(java.lang.String name, java.lang.String user, java.lang.String group, int size)
          Here's another way of writing a file into an archive: Call prepareWriting, then call writeData() as many times as wanted then call doneWriting( totalSize ).
 boolean writeDir(java.lang.String name, java.lang.String user, java.lang.String group)
          If an archive is opened for writing then you can add new directories using this function.
 
Methods inherited from class org.kde.koala.KArchive
addLocalDirectory, addLocalFile, close, closeSucceeded, device, directory, isOpened, mode, open, prepareWriting, writeData, writeDir, writeFile, writeFile, writeSymLink
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KAr

protected KAr(java.lang.Class dummy)

KAr

public KAr(java.lang.String filename)
Creates an instance that operates on the given filename.

Parameters:
filename - is a local path (e.g. "/home/holger/myfile.ar")

KAr

public KAr(org.kde.qt.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
Method Detail

fileName

public java.lang.String fileName()
The name of the ar file, as passed to the constructor.

Returns:
the filename. Null if you used the QIODevice constructor

prepareWriting

public boolean prepareWriting(java.lang.String name,
                              java.lang.String user,
                              java.lang.String group,
                              int size)
Description copied from class: KArchive
Here's another way of writing a file into an archive: Call prepareWriting, then call writeData() as many times as wanted then call doneWriting( totalSize ). For tar.gz files, you need to know the size before hand, since it is needed in the header. For zip files, size isn't used.

Overrides:
prepareWriting in class KArchive
Parameters:
name - the name of the file
user - the user that owns the file
group - the group that owns the file
size - the size of the file

doneWriting

public boolean doneWriting(int size)
Description copied from class: KArchive
Call doneWriting after writing the data.

Overrides:
doneWriting in class KArchive
Parameters:
size - the size of the file
See Also:
KArchive.prepareWriting(java.lang.String, java.lang.String, java.lang.String, int)

writeDir

public boolean writeDir(java.lang.String name,
                        java.lang.String user,
                        java.lang.String group)
Description copied from class: KArchive
If an archive is opened for writing then you can add new directories using this function. KArchive won't write one directory twice.

Overrides:
writeDir in class KArchive
Parameters:
name - the name of the directory
user - the user that owns the directory
group - the group that owns the directory

openArchive

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


closeArchive

protected boolean closeArchive()

finalize

protected void finalize()
                 throws java.lang.InternalError
Deletes the wrapped C++ instance

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.InternalError

dispose

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


isDisposed

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