Writer or OutputStream?

An OutputStream is a byte-oriented stream. Any text you write has to be encoded as bytes using some encoding (most commonly ISO-8859-1 or UTF-8). A Writer is a character-oriented stream that may or may not internally encode characters as bytes, depending on what it is writing to.

EDIT If you are designing a library, then if you provide an OutputStream-oriented interface to which text is to be written, you really should provide client classes the ability to control the encoding to be used.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)