Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.14.1
-
None
Description
QTextStream fills its internal buffer by reading bytes from the underlying QIODevice before that data is actually requested. There is no way to get the buffered data back. On the writing side, buffered data will be flushed to the device when QTextStream is closed, which makes it possible to use multiple QTextStream instances for the same device. Or use a QTextStream first and then write some binary data after it (think of the HTTP protocol, for example). On the reading side that is not possible, making the functionality asymmetric.
The expected behavior is that the underlying QIODevice is positioned after the last byte that was actually read through QTextStream, but an arbitrary amount of data after it is lost instead. Alternatively, the buffered data could perhaps be moved to QIODevice's buffer.
A simple demonstration of the problem is attached.