Re: BufferedReader.readLine() blocks unexpected
roele said:
According to JavaDoc
i [sic] cant find anything about readLine() blocking.
You sometimes have to dig through the Javadocs to get to the answer.
<http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html>
In general, each read request made of a Reader causes a corresponding read request to be made of the underlying character or byte stream.
OK, what does the underlying Reader's read() do? For that matter,
BufferedReader extends Reader:
<http://java.sun.com/javase/6/docs/api/java/io/Reader.html>
<http://java.sun.com/javase/6/docs/api/java/io/Reader.html#read()>
and related methods:
This method will block until a character is available, an I/O error occurs, or the end of the stream is reached.
<http://java.sun.com/javase/6/docs/api/java/io/Reader.html#read(char[])>
This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.
<http://java.sun.com/javase/6/docs/api/java/io/Reader.html#read(char[],%20int,%20int)>
This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.
QED.
You have to think through - if it says it's wrapping another method, then the
behavior of the wrapped method is relevant.
--
Lew