I tried QBuffer but it seems that it's not useful for me. I need something like the Buffer class in Java
Namely, I want to inject data in buffer and when I read n-size of data (from the end), this should be removed or the seek pointer should be moved in the correct position.
Context: I must send a file (line by line) through serial port. The main program injects the file and my thread which manage the connection, sends the data from buffer when is possible.
You could use a QBuffer with a QDataStream class.
So, the QBuffer provides a QIODevice over a byte array and the QDataStream then gives the serialization functionality that you desire.