I have a QDataStream that contains both text messages and GPBs. The stream has 24 bytes that serve as a header for the next message. The header tells me if it's text or GPB, and how many bytes the message is. If it's text, I simply read that many bytes, then read in the next 24 bytes of the next header. If the next message is GPB, the header also tells me what message it is. I want to use the ParseFromIstream() method for that message, but the argument for that method is an fstream.

So I guess my question is, is there a way to convert the QDataStream into an fstream? Better yet, does Qt have some way to parse data stored as a GPB?

I suppose I could just toss the QDataStream and use an fstream, but I would rather not.