2

I have a large .txt file with data in lines in the format

String int int double int int int double

eg:

monday 1 -1 43.5 2 1 1 -99999

tuesday 3 12 43.02 4 11 12 5.2

My text file has approximately 20,000 lines so i need a quick method of reading this in java.

What is the quickest method to read this kind of file in?


EDIT: I have used a function named textscan in MATLAB which worked perfectly (however i want to use java) so a similarly fast method would be perfect

Community
  • 1
  • 1
Eduardo
  • 6,900
  • 17
  • 77
  • 121

1 Answers1

1
String scan;
        FileReader file = new FileReader("C:\\Users\\workspace\\learn\\scan.txt");
        BufferedReader br = new BufferedReader(file);

        while((scan = br.readLine()) != null)
                {
            System.out.println(scan);
                }
        br.close();
Vibhu
  • 36
  • 5