FileJob Class Reference
from PyKDE4.kio import *
Inherits: KIO.SimpleJob → KIO.Job → KCompositeJob → KJob → QObject
Namespace: KIO
Detailed Description
The file-job is an asynchronious version of normal file handling. It allows block-wise reading and writing, and allows seeking. Results are returned through signals.
Should always be created using KIO.open(KUrl&)
Signals | |
close (KIO.Job job) | |
data (KIO.Job job, QByteArray data) | |
mimetype (KIO.Job job, QString type) | |
open (KIO.Job job) | |
position (KIO.Job job, KIO.filesize_t offset) | |
redirection (KIO.Job job, KUrl url) | |
written (KIO.Job job, KIO.filesize_t written) | |
Methods | |
__init__ (self, FileJobPrivate dd) | |
__init__ (self) | |
close (self) | |
close (self, KIO.Job job) | |
data (self, KIO.Job job, QByteArray data) | |
mimetype (self, KIO.Job job, QString type) | |
open (self, KIO.Job job) | |
position (self, KIO.Job job, KIO.filesize_t offset) | |
read (self, KIO.filesize_t size) | |
redirection (self, KIO.Job job, KUrl url) | |
seek (self, KIO.filesize_t offset) | |
KIO.filesize_t | size (self) |
write (self, QByteArray data) | |
written (self, KIO.Job job, KIO.filesize_t written) |
Method Documentation
__init__ | ( | self, | ||
FileJobPrivate | dd | |||
) |
__init__ | ( | self ) |
close | ( | self ) |
Close
Closes the file-slave
close | ( | self, | ||
KIO.Job | job | |||
) |
File is closed and will accept no more commands
- Parameters:
-
job the job that emitted this signal
- Signal syntax:
QObject.connect(source, SIGNAL("close(Job*)"), target_slot)
data | ( | self, | ||
KIO.Job | job, | |||
QByteArray | data | |||
) |
Data from the slave has arrived.
- Parameters:
-
job the job that emitted this signal data data received from the slave.
- Signal syntax:
QObject.connect(source, SIGNAL("data(Job*, const QByteArray&)"), target_slot)
Mimetype determined.
- Parameters:
-
job the job that emitted this signal type the mime type
- Signal syntax:
QObject.connect(source, SIGNAL("mimetype(Job*, const QString&)"), target_slot)
open | ( | self, | ||
KIO.Job | job | |||
) |
File is open, metadata has been determined and the file-slave is ready to receive commands.
- Parameters:
-
job the job that emitted this signal
- Signal syntax:
QObject.connect(source, SIGNAL("open(Job*)"), target_slot)
position | ( | self, | ||
KIO.Job | job, | |||
KIO.filesize_t | offset | |||
) |
The file has reached this position. Emitted after seek.
- Parameters:
-
job the job that emitted this signal offset the new position
- Signal syntax:
QObject.connect(source, SIGNAL("position(Job*, filesize_t)"), target_slot)
read | ( | self, | ||
KIO.filesize_t | size | |||
) |
Read block
The slave emits the data through data().
- Parameters:
-
size the requested amount of data
Signals the file is a redirection. Follow this url manually to reach data
- Parameters:
-
job the job that emitted this signal url the new URL
- Signal syntax:
QObject.connect(source, SIGNAL("redirection(Job*, const KUrl&)"), target_slot)
seek | ( | self, | ||
KIO.filesize_t | offset | |||
) |
Seek
The slave emits position()
- Parameters:
-
offset the position from start to go to
KIO.filesize_t size | ( | self ) |
Size
- Returns:
- the file size
write | ( | self, | ||
QByteArray | data | |||
) |
Write block
- Parameters:
-
data the data to write
written | ( | self, | ||
KIO.Job | job, | |||
KIO.filesize_t | written | |||
) |
Bytes written to the file.
- Parameters:
-
job the job that emitted this signal written bytes written.
- Signal syntax:
QObject.connect(source, SIGNAL("written(Job*, filesize_t)"), target_slot)