File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PrintWriter vs OutputStream

 
samdeep aarzoo
Ranch Hand
Posts: 160
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anybody help me
what is the difference between PrintWriter and OutputStream
which should we use . which is better?
 
David Ulicny
Ranch Hand
Posts: 724
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PrintWriter is only for character data and OutputStream for everything (binary data, character data).
 
Alexandre Cervieri
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In addition, you cannot use both PrintWriter and OutputStream. If you obtained one of them and try to get the other you will get a IllegalStateException. See also the following thread:
http://www.coderanch.com/t/170147/java-Web-Component-SCWCD/certification/servlet-getWriter-output-stream
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic