@Greetings
May I heartily express my best wishes to you, Earthlings!
@Message
I am happy to provide you with a vast improvement in hyperspace road traffic.
As you know these improvements are fundamental for our prospering
galactic economy.
@Explanation
I am sure that you are as overwhelmed as I am about these prospects and that
you will gladly contribute your planet as source of debris needed to outfit the
road curb of this new way to happiness, peace, wealth and overall welfare.
I am happy to provide you with a vast improvement in hyperspace road traffic.
As you know these improvements are fundamental for our prospering
galactic economy.
Sona Patel wrote:Hi Claudius,
You can do like this - read indexed file and store all the values into a hash table. hash table stores values a key-value pair. So store values into hash table as key="Message" and value="I am happy to provide you with a vast improvement in hyperspace road traffic.As you know these improvements are fundamental for our prospering galactic economy. "
While retrieving , you can retrieve value based on key. Read more about Hashtable. It will help.
Claudius Calvus wrote:Thanks for the answer. I thought about that, but the disadvantage is that I have to keep all the text in the memory of my computer. The text file which I aim at indexing is about 1.5 MB length with about 1000 text chunks. When I read the specifics correctly that should cause a problem on several platforms, at least with the JVM running on my Windows 7 computer.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Claudius Calvus wrote:My original intent was to save myself this recoding in the hope somebody has already written routines for "random access text files". I didn't find anything like that with Google, so I just started to write it myself now.
David Newton wrote:
Claudius Calvus wrote:My original intent was to save myself this recoding in the hope somebody has already written routines for "random access text files". I didn't find anything like that with Google, so I just started to write it myself now.
You don't actually want generic routines for "random access text files" though--you're looking instead for "text files indexed in a way nobody else does", which is a very different thing. Random file access already exists. All you need to do is create a map of keys and offsets. But for such a small amount of data, I'd just keep it in memory, because there's no real reason not to.
What's that smell? I think this tiny ad may have stepped in something.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
|