I'm using qt 5.3.
I have a big thing written into a QIODevice for read. I want to have a proxy to get the data while keep the data in QIODevice available for the other thing to read. So if I call readAll() I will get everything good in proxy but the other reader cannot get any data.
I think I should use peek() but this seems requires a maxsize. I tried for passing size() or bytesAvailable() but they didn't get me the real size. They returns probably a buffer size of some weird value as 3287. But my data is as huge as 1081530 bytes.
How can I get the true size of my QIODevice for read?
Edit: The QIODevice I mensioned above is actually QNetworkReply. I want to create a proxy to observe request and response data of my program with a QWebView to access some flash games. I implemented createRequest of my subclass of QNetworkAccessManager and the thing I want to analyze is which I catched through finished() signal of a reply from createRequest.
Edit2: I notice that this QIODevice is a sequential one so the size is unknown. But how to read the data without clearing it?
You can use
QIODevice::seek
and then read the data againfrom
seek
documantion: