X
Xaonon
I'm writing a program which will, in part, need to store and eventually
write out to files a fair amount of data, on the rough order of 10 MB. This
data consists of a series of ~10000 numbered records, each containing a few
kB of text on average and a handful of integers. I intend to save it in XML
format. Writing the data structure to hold these records is trivial.
Assume further that I don't have access to any sort of database; any file
I/O I'm going to have to do more or less by hand.
Now, the question is: exactly how should I save all of this? Performance is
an issue, so I'm leery of saving the whole thing in one big file and loading
it all in one gulp. Ten megs seems like a lot of memory for a program that
isn't displaying much more than plain ol' *text*... and only a small subset
of the records will be displayed at any given time, so it seems that I
should be able to get away with only loading them as needed. On the other
end of the spectrum I could save each record in its own file, but I know
that some filesystems have trouble with directories containing thousands of
files.
I'm very new to Java---I'm writing this program mostly just to teach Java to
myself---so please excuse me if there's some obvious solution I'm missing.
I'd be grateful for any suggestions.
write out to files a fair amount of data, on the rough order of 10 MB. This
data consists of a series of ~10000 numbered records, each containing a few
kB of text on average and a handful of integers. I intend to save it in XML
format. Writing the data structure to hold these records is trivial.
Assume further that I don't have access to any sort of database; any file
I/O I'm going to have to do more or less by hand.
Now, the question is: exactly how should I save all of this? Performance is
an issue, so I'm leery of saving the whole thing in one big file and loading
it all in one gulp. Ten megs seems like a lot of memory for a program that
isn't displaying much more than plain ol' *text*... and only a small subset
of the records will be displayed at any given time, so it seems that I
should be able to get away with only loading them as needed. On the other
end of the spectrum I could save each record in its own file, but I know
that some filesystems have trouble with directories containing thousands of
files.
I'm very new to Java---I'm writing this program mostly just to teach Java to
myself---so please excuse me if there's some obvious solution I'm missing.
I'd be grateful for any suggestions.