-2

I'm designing a library where a class should have an ability to be able to convert itself internals into text. Which class shall I use: OutputStream or Writer? And what is the key difference between them (in my case)?

LaurentG
  • 10,440
  • 8
  • 47
  • 64
  • 1
    Depends on what do you want to do with the text : write it into a file, send it by socket, make a XML document... Convert internal variables into text can be done without an `OutputStream` – Sw4Tish Aug 27 '13 at 09:40
  • WTF... this isn't just a duplicate, it's an exact copy of the first paragraph of that question. What's the point? – l4mpi Aug 27 '13 at 10:17

1 Answers1

1

The main difference is that a Stream writes bytes (binary data) while a Writer writes characters (text).

Choose what best fits your needs.

Henry
  • 41,816
  • 6
  • 58
  • 77