SocketTimeoutException and BufferedReader
I'd like to wrap a socket's InputStream in a BufferedReader and use readLine(). However, readLine's behavior seems to be undefined when the underlying stream throws a SocketTimeoutException. I found this thread from someone who was seeing readLine return buffered characters even though it hadn't received a newline. In my case, it seems to be discarding any buffered characters.
Does anyone know of a library with a version of BufferedReader that has clearly defined behavior in these circumstances? Ideally, I would like it to retain any buffered characters and return them on a subsequent call to readLine() after a newline has been received.