Question about binary data sotrage.
-
So I just wanted to know what would be the most practical way, most efficient way to store a binary file between 1Meg to 10Meg (tops) for searching etc... would it be a QList, QVector or a simple old QDataArray? Is there a "norm" for this?
Any feedback is much appreciated.
-
Sorry about that.
Just to store this in memory (temporarily as it will be written out to a file in the end) as I need to search for specific occurrences of raw binary data.
Breakdown;
1 - read the binary file into someing (QByteArray, QList, QVector etc...)
2 - search binary data thats now in memory
3 - possible editing of binary data in memory
4 - write out new binary data to flat fileHope this helps.
-
So, if I understand you correctly, you have one big blob of unstructured binary data, and you want to search if a specific binary sequence occurs anywhere in that blob. Right?
Edit:
you talk about reading it into containers. Does that mean that the data is structured after all? Do you need to search for a substring of any of these items, or do you only need to match on the whole item? -
Sorry, I don't get it. It is not structured (into items), yet you only need to match on a whole item?
If you do have basically a list of items, check out QMap if you need to keep the order of the items, and QSet otherwise. Otherwise, there is not much more choice than a linear searching of a QByteArray.