Results 1 to 4 of 4

Thread: reading from file[Resolved]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Resolved reading from file[Resolved]

    How can you read a certain line from a file without wasting your time processing each line like this:
    Code:
    try {
            BufferedReader in = new BufferedReader(new FileReader("infilename"));
            String str;
            while ((str = in.readLine()) != null) {
                process(str);
            }
            in.close();
        } catch (IOException e) {}
    Like, if I had a list of 5000 words, and I wanted to skip to the 1234th word, how would I do that? I know I could use a counting variable in the above example, but I wouldn't want to keep reading everyline like that untill I got to the right one.
    Last edited by NoteMe; May 25th, 2005 at 02:48 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width