RFR JDK-8003258: BufferedReader.lines()
Alan Bateman
Alan.Bateman at oracle.com
Sat Apr 27 08:15:59 UTC 2013
On 26/04/2013 22:59, Henry Jen wrote:
> Hi,
>
> Please review webrev at
>
> http://cr.openjdk.java.net/~henryjen/ccc/8003258.1/webrev/
>
> It adds a method to BufferedReader.
>
> public Stream<String> lines() {}
>
> A class java.io.UncheckedIOException is also added as a general approach
> for wrapping up an IOException to be unchecked.
>
> Cheers,
> Henry
>
I'm not so sure about setting expectations that you can readily mix
stream usage with the other methods that BufferedReader defines. This
puts a strict requirement on the implementation that it must be based on
readLines and that it can never do any read ahead.
The javadoc should probably specify that lines() returns a Stream even
if the reader is closed.
Otherwise just minor comments:
In UncheckedIOException then the @since should be 1.8. The @see probably
isn't needed here because there is already a link to IOException in the
description (but it doesn't matter).
I agree with Stephen's comment on finally { nextLine = null; }. It might
be more obvious with a simple:
String result = nextLine;
nextLine = null;
return result;
The test has the Classpath exception, I assume you'll put the pure GPL
header on this before you push.
-Alan.
More information about the core-libs-dev
mailing list