Results 1 to 4 of 4

Thread: FileReader

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Location
    Jutland, Denmark
    Posts
    71

    FileReader

    I have to "Convert" a file to a String.
    Do I have to use readLine and add every line or have Java a better way?

  2. #2

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Location
    Jutland, Denmark
    Posts
    71
    I am making a application to calculate how easy it is to read a text
    and somtime i have a string ond sometime i have a text file .
    in the class a use a string and here i have to calculate the numbers of word, nombers of longWord (>=7 char.) and mombers og word in a sentens.

  4. #4
    Addicted Member
    Join Date
    Nov 2001
    Location
    Yewston, Texis
    Posts
    240
    Sounds like you're writing the "Fog Index" program.

    Reading in the whole text may someday be practical when memory becomes much cheaper, say, ten years from now, but if you write this program and run it today, it'll be limited. It might be kind of fun to download a novel off the net and check it's reading level, but you may not be able to do this with your program as you propose it if you read in the whole text as a string because of exceeding memory.

    To improve the utility of your code, it would probably be a simple matter of taking your existing program that operates on a single string and putting a while loop around it so that it reads in many strings. Then from the heart of the program, remove the summary line that prints the results and move it so that it appears just after the loop. In this manner, every time you read a string, you can then keep a running tally of the results. Then when the program has completed reading the text file, it can report the results.

    cudabean

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