The Java I/O classes java.io.Reader
, java.io.Writer
, java.io.InputStream
, java.io.OutpuStream
and their various subclasses al
It depends on what you are closing. For example, closing a StringWriter
does nothing. The javadocs are clear on that. In this case, you can ignore the IOException because you know that it will never be generated. Technically, you don't even need to call close
.
/**
* Closing a StringWriter has no effect. The methods in this
* class can be called after the stream has been closed without generating
* an IOException.
*/
public void close() throws IOException {
}
For other streams, log and handle the exception as appropriate.