I have already read "Java: Why don't the PrintWriter or PrintStream classes throw exception?" but I am not interested in the reasons/excuses why those classes do not throw exceptions on output errors.
What I want to know is how to actually make them throw exceptions.
Or what else I can do with the least amount of work in order to get a replacement class for PrintStream which does the same but checks for errors and throws exceptions.
The obvious way would be to implement a wrapper class for PrintStream providing methods of the same names which call the corresponding PrintStream method, check for errors, and throw an exception if an error was detected.
However, this seems to be an awful lot of work, because PrintStream has a lot of methods.
So I wonder whether there is a simpler way.
Or perhaps someone else has already done the work if there was no other way around the obvious approach?
I find it hard to believe I would be the first one who considers immediately checking for output errors to be a good idea when writing to some output stream, instead of happily continuing in case of output errors as if nothing had happened.