Hello all,
I have a question regarding file reading (and before anyone points me at similar posts -
please hear me out - this is not your average file handling question!)
* I have a file of numerical data which I need to read.
* However I do not want to read a whole line of data at a time.
* Instead I need to read the first 'token' or value of each line until I reach the end-of-file.
*
Then I need to return to the first line of the file and read the second value and all subsequent second values for each line of the file and so-on until I have reached the last token on the last line of the file.
e.g. If I had a file containing the following data:
12 3 89 2 73 3
4 56 67 9 5 1
13 8 7 32 45 5
The program should read the data 12, 4, 13 followed by 3, 56, 8 and so on... until the last token of the file is read
I have tried using the StringTokenizer class and a pointer to keep tabs on which column is being read from to do this but can't seem to see how I can "reset" a BufferedReader to start from the 'top' of the file each time
it reaches the EOF.
The files being examined/read may be of the order of tens of thousands of lines and values so I cannot use the
mark()
and
reset()
methods of the BufferedReader class.
Any input regarding an approach to a possible solution would be gratefully received
Niall