sidwelle
asked on
java.io.BufferedReader readLine() //returns the entire file ?
I am using an implantation of Rhino Java and trying to read a file.
Several examples on-line show looping through the file line by line and appending each until the readLine() returns null, then you should have the entire file in you string that you were appending.
The behavior that I am observing is that the readLine() method is executed once and it returns the entire file ?
What is going on ?
I can search the string that it returns and I find the \r\n's in the proper locations ?
Several examples on-line show looping through the file line by line and appending each until the readLine() returns null, then you should have the entire file in you string that you were appending.
The behavior that I am observing is that the readLine() method is executed once and it returns the entire file ?
What is going on ?
I can search the string that it returns and I find the \r\n's in the proper locations ?
var reader = new java.io.FileReader(file);
var bReadr = new java.io.BufferedReader(reader);
var sb = new java.lang.StringBuilder;
while ((sLine = bReadr.readLine()) != null)
{
sb.append(sLine + "\n");
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Where, in the Java API, do you encounter the type "var" ? I missed that one.
ASKER
I think you are right, I keep getting these false errors that take a lot of time to track down.
This time there were two functions w/same name, should have thrown an error on compile.
Thanks
This time there were two functions w/same name, should have thrown an error on compile.
Thanks
If you attach the file, we can look