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.
Text? Writer
. It is intended for handling characters, honors encoding.
Stream/array of bytes? OutputStream
. Works on raw bytes, has no notion of characters, encodings, strings, etc.