|
-
Dec 28th, 2001, 11:55 AM
#1
Thread Starter
Lively Member
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?
-
Dec 28th, 2001, 02:43 PM
#2
Dazed Member
You have to convert a whole file ot a string For what purpose? Im just curious.
-
Dec 28th, 2001, 04:08 PM
#3
Thread Starter
Lively Member
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.
-
Dec 31st, 2001, 07:16 PM
#4
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|