The call PrintWriter.checkError()will tell you if any error has occurred. It does not specifically indicate which error occurred, but if checkError returns true, you can conclude that the most likely reason is a closed or broken socket.
If you keep a reference to the socket from which you receive the input stream, you can check the status of the socket.
, , " ", OutputStream, IOException ( ..), , - ,