Question about binary data sotrage.
-
wrote on 18 Apr 2011, 19:52 last edited by
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.
-
wrote on 18 Apr 2011, 20:21 last edited by
That would depend. Are you talking about storage on disk, or in memory? What do you need to search on? You really need to provide more details for good advice on this.
-
wrote on 18 Apr 2011, 20:28 last edited by
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.
-
wrote on 18 Apr 2011, 20:32 last edited by
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? -
wrote on 18 Apr 2011, 20:36 last edited by
the data is not structured and i only need to match the whole item.
-
wrote on 18 Apr 2011, 20:37 last edited by
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.
-
wrote on 18 Apr 2011, 20:40 last edited by
I will thanks :D
1/7