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)?
Asked
Active
Viewed 65 times
-2

LaurentG
- 11,128
- 9
- 51
- 66

user2710177
- 1
- 3
-
1Depends 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 Answers
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
- 42,982
- 7
- 68
- 84
-
Thanks for your responding so u please provide solution for this ? – user2710177 Sep 12 '13 at 13:38