org.kde.koala
Class KArchiveFile

java.lang.Object
  extended by org.kde.koala.KArchiveEntry
      extended by org.kde.koala.KArchiveFile
All Implemented Interfaces:
org.kde.qt.QtSupport
Direct Known Subclasses:
KZipFileEntry

public class KArchiveFile
extends KArchiveEntry

Represents a file entry in a KArchive.

See Also:
KArchive, KArchiveDirectory

Constructor Summary
protected KArchiveFile(java.lang.Class dummy)
           
  KArchiveFile(KArchive archive, java.lang.String name, int access, int date, java.lang.String user, java.lang.String group, java.lang.String symlink, int pos, int size)
          Creates a new file entry.
 
Method Summary
 void copyTo(java.lang.String dest)
          Extracts the file to the directory dest
 byte[] data()
          Returns the data of the file.
 org.kde.qt.QIODeviceInterface device()
          This method returns QIODevice (internal class: KLimitedIODevice) on top of the underlying QIODevice.
 void dispose()
          Delete the wrapped C++ instance ahead of finalize()
protected  void finalize()
          Deletes the wrapped C++ instance
 boolean isDisposed()
          Has the wrapped C++ instance been deleted?
 boolean isFile()
          Checks whether this entry is a file.
 int position()
          Position of the data in the [uncompressed] archive.
 void setSize(int s)
          Set size of data, usually after writing the file.
 int size()
          Size of the data.
 
Methods inherited from class org.kde.koala.KArchiveEntry
archive, date, datetime, group, isDirectory, name, permissions, symlink, user
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KArchiveFile

protected KArchiveFile(java.lang.Class dummy)

KArchiveFile

public KArchiveFile(KArchive archive,
                    java.lang.String name,
                    int access,
                    int date,
                    java.lang.String user,
                    java.lang.String group,
                    java.lang.String symlink,
                    int pos,
                    int size)
Creates a new file entry.

Parameters:
archive - the entries archive
name - the name of the entry
access - the permissions in unix format
date - the date (in seconds since 1970)
user - the user that owns the entry
group - the group that owns the entry
symlink - the symlink, or null
pos - the position of the file in the directory
size - the size of the file
Method Detail

position

public int position()
Position of the data in the [uncompressed] archive.

Returns:
the position of the file

size

public int size()
Size of the data.

Returns:
the size of the file

setSize

public void setSize(int s)
Set size of data, usually after writing the file.

Parameters:
s - the new size of the file

data

public byte[] data()
Returns the data of the file. Call data() with care (only once per file), this data isn't cached.

Returns:
the content of this file.

device

public org.kde.qt.QIODeviceInterface device()
This method returns QIODevice (internal class: KLimitedIODevice) on top of the underlying QIODevice. This is obviously for reading only. Note that the ownership of the device is being transferred to the caller, who will have to delete it. The returned device auto-opens (in readonly mode), no need to open it.

Returns:
the QIODevice of the file

isFile

public boolean isFile()
Checks whether this entry is a file.

Overrides:
isFile in class KArchiveEntry
Returns:
true, since this entry is a file

copyTo

public void copyTo(java.lang.String dest)
Extracts the file to the directory dest

Parameters:
dest - the directory to extract to

finalize

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

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

dispose

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

Overrides:
dispose in class KArchiveEntry

isDisposed

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

Overrides:
isDisposed in class KArchiveEntry