If there is an input file with tons of records, each record with be one line, each record is consisted of one id number, time the record is created and record content. Then what will be the best way to read and parse the file?
For example, the input is:
123-456-789 1:23pm Jan 4, 2014 I AM THE CONTENT! 987-654-321 3:21pm Apr1, 2014 I AM THE CONTENT TOO! …
To read one line each time, I believe there is no much difference between scanner and bufferedReader because scanner also has 1k buffer. So may I do:
Scanner scan = new Scanner(new File("filename"))?
Then after I get one line, should I make another scanner object to parse the line and get each field (I can give the line as the input for the scanner)? Or is there any other better solution?
For experienced programmer, what should be the best way (fast, better performance) to do read and parse such a file with tons of records in real world? Thank you!