Inverno said:
Basically all you need is a File object and print and read Streams, check
the documentation on the various printStreams and readers and choose the one
that best fits you.
Then, to manipulate resulting strings you use StringTokenizer or
String.split(regex);
tries,
I really don't understand here.. what you mean? Once you read from a file
you have to put the data somewhere for you to use, i.e. a data structure of
some kind, shouldn't you?
And if you want to -store- data you certainly can't just leave it in a
hashtable or other data structures, as those will of course vanish once
thetanto program is terminated... do you mean something else when you
say -store-? As I really can't see what you mean.
Me neither - apart from having to store the data somewhere in RAM at some
point, you'll have to use a lot of files if you're trying to map 1 node in a
trie or one entry in a hashtable to a single file. A lot of files will pose
a problem like "Too many open files" (if you need them all to be accessed at
once). You may face a problem with the OS' max number of files.
Other than that - file-access is much slower than memory access.
Are you trying to build a database in Java?
If you just want object persistence, then I would suggest a Serializable
datastructure i RAM, which you'll store once in a while. Or perhaps use a
free database like mysql or postgresql.
Well the solution to your problem all depends on what you want to do. A few
properties to be stored/read - then use java.util.Properties (which is
actually a hashtable), a massive amount of data - as in a dictionary - then
I would suggest storing the words in a single file and combine this with a
trie. Use java.io.FileInputStream, InputStreamReader, and BufferedReader for
reading and PrintWriter, BufferedOutputStream, and FileOutputStream for
writing.
/nobody important