QDataStream it isn't just "for" QByteArray, it's for serialization of your data to an io device (file, etc...) Read the documentation here.