benlau
24th February 2010, 05:59
Hi,
I need to transfer data from a QIODevice to another. The simplest way is to read all the data from the source to memory, and write to the target .
Example:
void copy(QIODevice *source , QIODevice *target){
target->write(source->readAll());
}
However, the source may contains few hundred MB of data. It will hold a lot of memory during transfer. It is better to implement an async read and write operation , each time will only read/write a smalller amount of data. It should be not difficult to make by using bytesWritten and readyReady signal.
Before making my own class , I would like to ask is any there similiar class is already existed in Qt?
Thanks for any advise.
I need to transfer data from a QIODevice to another. The simplest way is to read all the data from the source to memory, and write to the target .
Example:
void copy(QIODevice *source , QIODevice *target){
target->write(source->readAll());
}
However, the source may contains few hundred MB of data. It will hold a lot of memory during transfer. It is better to implement an async read and write operation , each time will only read/write a smalller amount of data. It should be not difficult to make by using bytesWritten and readyReady signal.
Before making my own class , I would like to ask is any there similiar class is already existed in Qt?
Thanks for any advise.