Nov 8, 2018

Printwriter vs OutputStream vs PrintStream

OutputStreams are meant for binary data. Writers (including PrintWriter) are meant for text data.

All characters printed by a PrintStream are converted into bytes using the platform's default character encoding. The PrintWriter class should be used in situations that require writing characters rather than bytes.

PrintStream and Printwriter never throw an IOException. OutputStream can throw an IOException.