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 ?

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");
	}

Open in new window

sidwelleAsked:
Who is Participating?
 
dpearsonConnect With a Mentor Commented:
That code looks fine, so it sounds like some issue with the Rhino implementation.

I'd suggest stepping into the "readLine" method inside a debugger to see what it's reading.  The code should be pretty easy to follow as it scans the contents of the file.

Doug
0
 
CEHJCommented:
What is going on ?
There's <= 1 line in the file?

If you attach the file, we can look
0
 
krakatoaCommented:
Where, in the Java API, do you encounter the type "var" ? I missed that one.
0
 
sidwelleAuthor Commented:
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
0
All Courses

From novice to tech pro — start learning today.