« Return to Thread: Source.fromFile(file).getLines

Re: Source.fromFile(file).getLines

by Ricky Clarkson :: Rate this Message:

Reply to Author | View in Thread

I'd guess not.  You might want to use java.util.Scanner until this is fixed.

2009/7/9 Gilles SCOUVART <Gilles.SCOUVART@...>:

> Hello all,
>
> I was surprised to notice that using Source.fromFile(file).getLines on a
> file with empty lines, those were added to the previous non empty line.
> I.e. if the file contains this:
> ------
> test
>
>
> ------
> then getLines.next would return "test\n\n" (written java-echap-style).
> I expected it would iterate on three lines instead: "test", "", and "".
> This is a little bit annoying for pattern matching on full lines...
>
> Is this expected behaviour?
>
> Gilles Scouvart.



--
Ricky Clarkson
Java Programmer, AD Holdings
+44 1565 770804
Skype: ricky_clarkson
Google Talk: ricky.clarkson@...

 « Return to Thread: Source.fromFile(file).getLines